2

I'm trying to prevent an alert() modal from appearing when used in a UIWebView. Many others suggest the use of overriding window.alert like this:

- (void)webViewDidFinishLoad:(UIWebView *)thisView {
    [MyWebView stringByEvaluatingJavaScriptFromString:@"window.alert=null;"];
}

However in the page I'm loading the alert() is called before the page has finished loading.

Rather than disabling alert at the JS level, how can I override/disable it at the iOS level?

Community
  • 1
  • 1
Josh Hunt
  • 14,225
  • 26
  • 79
  • 98
  • Have you seen http://stackoverflow.com/a/1585854/836214 ? It seems to cover exactly this. – Krease Jan 13 '14 at 06:02
  • Since timing was an issue for me as well I ended up blocking the alert on a native level: http://stackoverflow.com/a/21698251/154915 – ABeanSits Feb 11 '14 at 09:49

0 Answers0