Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Denied starting an intent without a user gesture Webview Android

Trying to redirect local html page in android webview using Javascript redirect, gets denied starting an intent in Logcat:

Testing on android 5.1.1

document.location = "index.html";

Denied starting an intent without a user gesture, URI:

file:///android_asset/index.html

like image 863
Abdullah Avatar asked Oct 10 '15 00:10

Abdullah


2 Answers

I read the documentation in 1,000 attempts Android.developer and this was my solution

I do not know if you understand, I speak Spanish

webView.setWebViewClient(new WebViewClient() {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        return false;                
    }
});
like image 197
Wilber Paredes Avatar answered Oct 15 '22 00:10

Wilber Paredes


This worked for me:

webView.setWebViewClient(new WebViewClient());
like image 18
Omar Aflak Avatar answered Oct 15 '22 01:10

Omar Aflak