Several questions have been asked on SO regarding similar issues, but none have addressed my specific question. Many of the answers suggest running a JS snippet that overloads the alert method, like this: window.alert = function() {};
The issue I am facing is that a webpage (whose content I cannot control) triggers an alert before the entire page has finished rendering.
Due to this, I am unable to utilize the
- (void)webViewDidFinishLoad:(UIWebView *)webView
delegate method to execute the JS snippet. Running the snippet in - (void)webViewDidStartLoad:(UIWebView *)webView
also doesn't help because it runs before the DOM is loaded.
Related questions:
- Capture (and prevent) alert() modal in UIWebView
- Can I handle alert inside UIWebViewDelegate?
- UIWebView: Can I disable the javascript alert() inside any web page?
Any suggestions on how to approach this problem?