skhurams
skhurams

Reputation: 2145

Page redirection for mailto and tel links on Android

I have a working Cordova iOS app. Now I am working on an Android app. I have a "contact us" page where I have a link:

 <a id="lnkEmail" style="border: none;box-shadow: none;text-align: left;" data-role="button"  href="#">  [email protected]          </a>

 $('#lnkEmail').on('click',function(){
         document.location.href = "mailto:[email protected]";
    });

The page is redirected to a "webpage not available" error page while the link opens in an email client. How do I stop page redirection? I have tried:

 <a style="border: none;box-shadow: none;text-align: left;" data-role="button"  **href="mailto:[email protected]"** target="_top">[email protected] </a>

As well as:

 <a id="lnkEmail" style="border: none;box-shadow: none;text-align: left;" data-role="button"  **href="javascript: void(0);"**>[email protected]</a>  [email protected]         </a>

How can I fix this ?

Upvotes: 0

Views: 691

Answers (1)

jcesarmobile
jcesarmobile

Reputation: 53341

There is a bug on how the mailto is handled and it try to navigate to the page before loading the email client.

You can try using inAppBrowser plugin

window.open('mailto:[email protected]', '_system');

Upvotes: 3

Related Questions