I use the shouldOverrideUrlLoading method for an application that is personalized for multiple clients. Each client has their own web page, which wants to be uploaded to webview. My problem is this: the application is great for client A and its web page, but not for client web page B (which has nothing to do with client A). The difference, as I tested, is that in the situation of client B for links that are available in the downloaded content in the web view, shoulOverrideUrlLoading does not work (NEVER is invoked), but for the client web page it works fine. Another thing is that the client B web page does not work only on some versions of Android, such as 2.1 or 2.3.6, but works fine on 2.3.3, 2.3.5, 4.0.2 or 4.0.3.
So this is strange. If you know something, please help! Thanks!)
EDIT: I noticed that shouldOverrideLoading is not called when the webpage does NOT load the requested link through javascript, and it works when javascript is not used !!! but when I set webview.setJavaScriptEnabled (false), it works !!! I really need javascript to be enabled for my application because web pages usually use javascript for things other than loading, so I can't turn it off just because shouldOverrideUrlLoading does not receive the call!
EDIT 2: more precisely:
This works and should be called by calling OverrideUrlLoading:
<p onclick="location.href='linkHere'"> NewLink <span class="icon-arrow"></span> </p>
This does NOT work, and shouldOverrideUrlLoading is NOT called:
<a class="link-inherit" href="linkHere"> NewLink <span class="icon-arrow"></span> </a>
source share