micky
micky

Reputation: 245

webview shouldOverrideUrlLoading not working

I call my file in my local storage in html format and display in webview. in my html contain a url which will click and display in the same webview. But when i call shouldOverrideUrlLoading is not working. Any help?

webview.loadUrl("file:///"+file); 
webview.getSettings().setJavaScriptEnabled(true);

webview.setWebViewClient(new InsideWebViewClient());


private class InsideWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);

    return false;
}

}

Upvotes: 1

Views: 1595

Answers (2)

Hill
Hill

Reputation: 429

Loading url with scheme like file:///android_asset, and iframes will not trigger shouldOverrideUrlLoading.

Upvotes: 1

TootsieRockNRoll
TootsieRockNRoll

Reputation: 3288

return true; instead

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);

    return true;
}

Upvotes: 0

Related Questions