Tag Archives: android webpage err_unknown_url_scheme

[Five Method to Solve] android webpage err_unknown_url_scheme

Create an Android WebView demo to access the web page

As a result, the simulator reported an error: webpage err_ unknown_ url_ scheme

 

Solution:

Method 1:

 webView.setWebChromeClient(new WebChromeClient());

     
        webView.getSettings().setJavaScriptEnabled(true);  //Set the WebView properties, run the js script
        webView.loadUrl("https://www.baidu.com/"); //call the loadUrl method to add a link to the WebView
        setContentView(webView);

Method 2:

// webView.setWebViewClient(new WebViewClient() {
// // Set the new web page opened by clicking on the webView to be displayed in the current interface without jumping to a new browser
//            @Override
//            public boolean shouldOverrideUrlLoading(WebView view, String url) {
//

//
//                if( url.startsWith("http:") || url.startsWith("https:") ) {
//                    return false;
//                }
//                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
//                startActivity(intent);
//                //  When the following line is kept, the original page still reports an error, but the new page is fine. So after commenting it out, there is no problem
//                //          view.loadUrl(url);
//                return true;
//
//
//
//
//
//
//
//
//        }
//        });

Method 3:

webView.getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0");

It looks like it’s accessible

 

Method 4:

if (httpurl.startsWith(“scheme:”) || httpurl.startsWith(“scheme:”)) {
Intent intent = new Intent(Intent.ACTION_ VIEW, Uri.parse(httpurl));
startActivity(intent);
}
return false;

 

Method 5:

Direct return false

 webView.setWebViewClient(new WebViewClient() {
            @Override
           public boolean shouldOverrideUrlLoading(WebView view, String url) {
                return  false;
            }

        });