I am using uiwebview in my app to display html pages within the app. I want to call javascript function in html page when app comes to foreground from background. I have tried using stringByEvaluatingJavaScriptFromString with no luck.
1 Answer
It is good idea to show your code if you face some issue & if you are using the webview properly and its delegate then it should call the methods properly, this is how I have been calling the jscript method and it has always worked
[ self.myWebView stringByEvaluatingJavaScriptFromString: @"callJsMethod();" ];
or sending value to the jscript method
[self.myWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"callJScriptMethod('%d')", argInteger]];
1 Comment
nikBhosale
Thanks for your reply. I Can call javascript function from button click. But I want to call that function in method applicationWillEnterForeground . But the JS function does not get called.