Dead loop in android webview backkey for redirect href link

后端 未结 4 2278
挽巷
挽巷 2021-02-14 10:30

I got to a dead loop in Android webview application with backkey while dealing with redirect links.

For example, when my webview started, it goes to link0.

In l

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-14 11:35

    webview.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                Log.i(tag, "url = " + url);
                // view.loadUrl(url);
    
                // return super.shouldOverrideUrlLoading(view, url);
                return false;
            }
        });
    

    look!!!! the important, shouldOverrideUrlLoading must return false

    in shouldOverrideUrlLoading you can't invoke view.loadUrl.

提交回复
热议问题