Search code examples
ioscordovacordova-pluginspwabuilder

allow-navigation isn't taking precedence over allow-intent on iOS


I generated an iOS and Android Pollyfill for my PWA app with PWAbuilder. It is working great on Android, but I'm running into an issue on the iOS one.

I want external links to open in the external browser, so I added this allow-intent:

<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />

This worked fine, if I click on any external link (not-under-my-domain.com), it opens in the external browser.

For opening my-domain.com within the app, I added

<allow-navigation hap-rule="yes" href="*://my-domain.com/*" />

According to the docs, allow-navigation should take precedence over allow-intent, but it does not seem to be working.

Then if I click on any link within my domain, such as /other-page, it opens in the external browser - which isn't expected, it should open within the app.

I would like to have any link not defined in allow-navigation to open in the external browser, and all others (under my-domain.com) within the app.

Any ideas?


Solution

  • So after all it seems the problem was with my outdated version of cordova. I upgraded the cordova version following @jcesarmobile's suggestion on the comments and it is working now.

    npm install cordova -g
    cordova plugin save
    cordova platform rm ios
    cordova platform add ios