0

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 1

2

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]];
Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.