How to Fix Unknown URL Scheme in Android WebView

Fix err_unknown_url_scheme intent:// Android WebView


This error is caused by the WebView can’t recognize the URL Scheme, for example, the WebView will usually recognize http and https, anything other than these, example – intent://,market://,app://,mail:// etc will not be recognized by webview unless we add a handler to handle these url schemes.


Here is the error screen



In this tutorial, we will learn how to handle the intent:// url scheme. i noticed this error when i built an app that loads facebook messages, the error appeared whenever i tap on the message icon of facebook. i suppose this is because the facebook is sending you to app store to download the messenger app when you tap on the message icon. in the below code, we will fix it.

The Code to Fix err_unknown_url_scheme intent://


webview.setWebViewClient(new WebViewClient() {
           String currentUrl;

           public boolean shouldOverrideUrlLoading(WebView view, String url) {
               currentUrl = url;

               if (url.startsWith("http") || url.startsWith("https")) {
                   return false;
               if (url.startsWith("intent")) {

                 try {
                     Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);

                     String fallbackUrl = intent.getStringExtra("browser_fallback_url");
                   if (fallbackUrl != null) {
                       return true;

               catch (URISyntaxException e) {
                   //not an intent uri
       return true;//do nothing in other cases


What we did in this code is whenever the url we clicked contain intent:// scheme, we try to override it and get the fallbackUrl to the string, then we try to load the url. this should fix the error

, ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.