0

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?

2 Answers 2

1

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 the UIWebView.

Sign up to request clarification or add additional context in comments.

1 Comment

This has helped thanks. It turned out I had a bit of javascript to help other browsers on button click performance, but it stop me on safari clicking completely
1

Make sure that your HTML page is including the file with that function and the base URL of your webview is correctly set.

edit oops ignore the first half if it works with a button. Second half still applies.

Comments

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.