javascript - Defining event on UIWebView -
forgive me beingness rather new (that new) ios development.
i have implemented native facebook authorization, , want pass access_token local html file in uiwebview. sake, have created javascript object in html file, init function receives access_token parameter. need externally phone call function. research got me [uiwebview stringbyevaluatingjavascriptfromstring:(nsstring *)]
- should not called until page has been loaded.
in viewcontroller.m
have defined - (void)updateview
in request on webview
uiwebview
. execute javascript string particular requests completes. how do that?
- (void)updateview { appdelegate *appdelegate = [[uiapplication sharedapplication]delegate]; if (appdelegate.session.isopen) { nsurl *url = [nsurl urlwithstring:[nsstring stringwithformat:@"http://mydomainwuhuu/mobile?o=auth&accesstoken=%@", appdelegate.session.accesstoken]]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; [webview loadrequest:request]; [webview stringbyevaluatingjavascriptfromstring:@"window.alert('test')"]; } }
this code doesn't it, , think it's because phone call javascript before page finished loading? how fix?
uiwebview has delegate methods see this.for situation create utilize of – webviewdidfinishload:
.
javascript ios xcode uiwebview
No comments:
Post a Comment