I am building a hybrid mobile app with Visual Studio Tools for Apache Cordova that is able to make phone calls, send text message or emails, view a location on a map, etc. These are all handled with external applications (for instance use Gmail to send an email or Maps to pinpoint a location). They are placed in an anchor tag in HTML, such as <a href="tel:12345678">, <a href="sms:12345678">, <a href="mailto:name@domain.com"> or <a href="geo:...">. These work fine except that when you execute one of these actions and the system opens another app you see for a short time a webview with an error: “Web page not available”. Then the external app opens, you take the action and then go back to the app. At that point you again see this webview with the error as shown below.

ERR_UNKNOWN_URL_SCHEME when sending a text message

ERR_UNKNOWN_URL_SCHEME when sending a text message


This seem to be a known issue as I found many references of it on the web. Here are several for reference:

I am using the InAppBrowser plugin to open links in external apps. In order for this to work the schemes must be white-listed in Cordova’s config.xml file and the launch-external attribute should be set to true (which was already set in my case).

The indicated solution is to override WebView.shouldOverrideUrlLoading method.

I added the following in plugins\cordova-plugin-inappbrowser\src\android\InAppBrowser.java in the plugin’s WebView extension, but that did not work as the code did not even execute.

Looking for a solution I have noticed that this was only working OK for tel: and for others it was exhibiting this behavior. Then I found the following code in the InAppBrowser plugin class, in the execute() method.

I have changed that to include the other schemes and that fixed the problem.

With this in place, the web page error no longer shows up for any URL scheme.

I’m not sure if this is the best solution, but it is the only one that I managed to implement.

, , , , , , , Hits for this post: 31315 .
Trackback

10 comments untill now

  1. Hello Sir,

    I have the same problem but in the store on ebay, our mail not works on android.
    Can i correct in the html the problem with a code ?

  2. Hey please fix it

  3. public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if( url.startsWith(“http:”) || url.startsWith(“https:”) ) {
    return false;
    }

  4. Hello sir I got one issue like it’s like d pop up notification in which it gives web page is not available n I want to know what is the actual problem

  5. I was using WHATSAPP and suddenly it stop and shows net::ERR_UNKNOWN_URL_SCHEME. WHAT WILL I DO. Now I cannot downliad Whatsapp

  6. Munir Akhtar Baig @ 2016-10-06 13:56

    Viber on my cellphone couldn’t installed in spite repeatedly trying.Could you Pl.help.

  7. Christian cortejos @ 2017-04-09 09:51

    Its de same problem.

  8. Christian cortejos @ 2017-04-09 09:58

    How to erase this EER_UNKNOWN_URL_SCHEME. What will I do.

  9. Salut am citit cu interes implementarea facuta de tine cum as putea face in cazul ca as dori sa deschis linkuri care incep cu “sop://” si “acestream://”
    daca ma poti ajuta iti multumesc anticipat

  10. I still want to know how to fix my devise.why can’t I load a new page

Add your comment now