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?