-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't open mailto: / tel: / sms: links in IAB under iOS: URL not supported #830
Comments
You can just use the last version of InAppBrowser (4.1.0 for now), and open the external link* using "cordova.InAppBrowser.open" instead of "window.open". Also, include the "hidden=yes", like this (it fixed some problems in iOS):
*It also works with "mailto", "tel", "whatsapp"... for Android, you just have to allow the intent and give permissions in config.xml file, like this:
Finally, if you want all page loads in your app to go through the InAppBrowser, you can simply hook "window.open" during initialization:
|
@fernandoghisi the issue here is actually about opening those links from within the InAppBrowser and not from the Cordova WebView, i.e. within the InAppBrowser The scenario you're referring to is covered by #592 and #775; for them your solution is correct and I can confirm they work. But unfortunately not for this issue. |
Hello @acran, did you find a solution please ? Thx in advance. |
You certainly find the solution. If not : |
@jay34fr see my previous #830 (comment): #592 is about opening those links from the Cordova WebView. |
Hi,
|
I have the same issue on Android and using cordova-pluing-inappbrowser 4.1.0 I am using the InAppBrowser to view an external html file. This file contains a "geo:"-URL, an clicking on that URL yields the same problem. Logcat shows "E/InAppBrowser: Possible Uncaught/Unknown URI" |
@acran - If I change the target to Unfortunately, |
|
Any update? |
I have a solution to this in our Angular 10 Capacitor App. This should work in vanilla cordova apps too. But hooking into beforeload and opening the links with window.open did work for us. const browser = this.iab.create(url, '_blank', this.options);
browser.on('beforeload').subscribe((event) => {
// Check if event url is an action link
if (event.url.startsWith('tel:') || event.url.startsWith('mailto:')) {
console.log('Found an action link! ' + event.url);
window.open(event.url, '_system');
return;
}
// more workarounds
...
// Nothing from above applies. Continue loading
console.log('Beforeload released. Continue loading ' + event.url);
browser._loadAfterBeforeload(event.url);
}); I hope this helps anyone! |
@JensUweB see my previous #830 (comment): This issue is about opening such action links from within the InAppBrowser window where the InAppBrowser API is not available. Your code snippet will only work in the Cordova WebView. See related issues #592 and #775 which refer to issues within the Cordova WebView. |
Save JensUweB!!! |
Since this issue got quite a lot of attention and the last plugin release (tag 5.0.0.) was more than 2 years ago (Feb, 10, 2021), I wonder when there will be a new release of the plugin cordova-plugin-inappbrowser that contains the fix of this issue? @NiklasMerz |
Bug Report
Problem
Opening links for
mailto:
/tel:
/sms:
protocols from a page in the in-app-browser does not work.What is expected to happen?
Having a page with a link like
in the in-app-browser and clicking it should open the mail app with the compose view for the specified address.
Links to a
tel:
orsms:
URI should open the dialer / SMS app respectively.What does actually happen?
Clicking the links under iOS does nothing. In the console an error is logged: URL not supported
Information
<a href="mailto:mail@example.net">send mail</a>
window.open('mailto:mail@example.net')
window.open('mailto:mail@example.net', '_blank')
window.open('mailto:mail@example.net', '_system')
window.location.href = 'mailto:mail@example.net'
Command or Code
I tested and verified this with a clean new and minimal Cordova app
cordova-plugin-inappbrowser
mailto:
/tel:
/sms:
links in the in-app-browserYou can find a sample app here: https://github.com/acran/cordova-inappbrowser-mailto-bug-sample
The
config.xml
:Environment, Platform, Device
Verified on iPhone 12 with iOS 14.
Version information
Checklist
The text was updated successfully, but these errors were encountered: