apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.15k stars 987 forks source link

Using allow-navigation impacts allow-intent on iOS #1285

Open El-Tommy opened 1 year ago

El-Tommy commented 1 year ago

In my app I have some links with the tag <a href=""> and also with javascript with the code below.

let url = param;
window.open(url, '_system');

My config.xml is configured as below, and opening links works perfectly, when clicking on a link or executing the window.open function, it opens Safari and the URL together.

<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />

However, as I need to display some videos from YouTube and Vimeo (iframe), I needed to add the allow-navigation tag, but when I do that, the allow-intent setting is ignored and all links start opening inside the app.

<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />

<allow-navigation href="https://*youtube.com/*"/>
<allow-navigation href="https://*vimeo.com/*" />

I use https://*/*because the user can make infinite URLs available and so it would be interesting for him to be able to open any one.

I don't know if this is a bug or my fault.

El-Tommy commented 1 year ago

One option would be to go through all the static and dynamic links (which come via AJAX requests) and add an onClick event to use the inAppBrowser with _system, but I don't know how to do this.