7

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?

Pablo Cantero
  • 6,239
  • 4
  • 33
  • 44
  • 2
    what's your cordova-ios version? I've been trying with 4.5.4 and seems to work fine. I've created an app that loads google and allows google navigation and it does the search, but the results are open in safari. Also tried loading different `www.example.com` urls after allowing `` and all of them open inside the app. – jcesarmobile Jun 23 '18 at 21:26
  • It's possible that you need to add: Don't allow insert asterisk, you need to add inside the asterisk -> * and NSAppTransportSecurity NSAllowsArbitraryLoads – Lito Jun 27 '18 at 09:23
  • @jcesarmobile I generated the iOS version using https://www.pwabuilder.com and I'm having a hard time to find the version. How can I tell it based on the Xcode project? – Pablo Cantero Jul 03 '18 at 00:56
  • @Lito I tried to leave it with "", but it didn't do the trick. – Pablo Cantero Jul 03 '18 at 01:47
  • @PabloCantero `I said you need to add inside the asterisk -> *`, but web don't allow set asterisk ` ` – Lito Jul 03 '18 at 06:47
  • The Cordova.js fiel should contain the Cordova version – jcesarmobile Jul 03 '18 at 07:42
  • @jcesarmobile I found this `PLATFORM_VERSION_BUILD_LABEL = '4.1.1'` on ios/www/cordova.js, is that the version? – Pablo Cantero Jul 04 '18 at 11:55
  • @Lito understood, thanks! Changing to ` ` is causing all links to open in the external browser. – Pablo Cantero Jul 04 '18 at 11:56
  • @jcesarmobile upgrading cordova did the trick. Thanks! – Pablo Cantero Jul 07 '18 at 21:28

1 Answers1

0

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
Pablo Cantero
  • 6,239
  • 4
  • 33
  • 44