Issue
My Android app uses a WebView to let the user navigate around the Internet, but occasionally it encounters a site that navigates using its own funky schema. For example, if you search for "aliexpress", the app will take you to the site's Home page just fine.
However, if you select any of the buttons on the top, WebView throws an error:
Solution
All I needed to do was call shouldOverrideUrlLoading() as follows:
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
Uri current_page = request.getUrl();
if (!current_page.toString().startsWith(("http://")) && !current_page.toString().startsWith(("https://"))) return true;
return false;
}
Answered By - FractalBob
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.