Issue
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).
Solution
Do you have an example of a website?
You should be able to override WebChromeClient.onConsoleMessage(ConsoleMessage consoleMessage).
Answered By - Kristian
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.