Using WebView, certain websites take very long time to complete page load (as in WebViewClient.onPageFinished()) and, when that happens, this is characterize by Web Console errors of the following type:
E/Web Console(1916): Unsafe JavaScript attempt to access frame with URL
http://mobile.example.com from frame with URL
http://ad.doubleclick.net/adi/interactive.example.com/front_sub;sz=320x50;ord=7340930261983.
Domains, protocols and ports must match.
05-26 10:44:15.274: E/Web Console(1916): at null:1
I would like to be able to catch those errors and handle them in some way. e.g. issue a message or anything relevant to my app, actual handling is irrelevant at this point to the core question:
Is there a way to catch those errors? i.e. in a way that my app can be notified?
Note: This is not a Javascript question. I am not programming a website. I am accessing an existing website whose implementation is beyond my control. This is a WebView question (currently in the Android environment, but could be in other environments which are capable of hosting WebView as well).
Do you have an example of a website?
You should be able to override WebChromeClient.onConsoleMessage(ConsoleMessage consoleMessage).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With