I have a UIWebView that loads a website. Then in
- (void)webViewDidFinishLoad:(UIWebView *)webView
I try to run the function
[webView stringByEvaluatingJavascript:@"myFunction();"];
but it doesn’t work it does nothing.
I have but this under a button as well and at first it does nothing.
but when I tap the UIWebView and press the button it works fine.
Has anyone got any ideas why this isn’t working?
Try calling
alert()to make sure the problem isn’t in your javascript function. If you are able to see the popup box you will know the problem lies in your javascript, and not in theUIWebView.