nikBhosale
nikBhosale

Reputation: 541

How to Call a javascript function from html page opened in uiwebview when app comes to foreground?

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.

Upvotes: 0

Views: 683

Answers (1)

nsgulliver
nsgulliver

Reputation: 12671

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]];

Upvotes: 2

Related Questions