Cordova-plugin-ionic-webview: external navigation rejected error

Created on 17 Dec 2019  路  4Comments  路  Source: ionic-team/cordova-plugin-ionic-webview

Hi, I upgraded from version 2.x to 4.x and get the following error when tapping on any links in my cordova app:

External navigation rejected - <allow-intent> not set for url='unsafe:ionic...

I suppose I could add <allow-intent> for unsafe:ionic:// but I'm guessing this isn't expected behavior. Reverting to 2.x fixes the issue.

cordova 9.0
cordova-ios 5.0.1

Most helpful comment

Thanks. For anyone who stumbles upon this, you need to use something like this...

  .config(function ($compileProvider) {
    $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|mailto|tel|ionic):/);
  })

All 4 comments

This is not cordova-plugin-ionic-webview issue. unsafe: prefix added by angular

as explained by cmbilisim, the unsafe is added by angular, so you should configure it to not do it, or build your app in a different way so it doesn't have links to ionic://, not sure how you are using it, but you usually have a router to navigate instead of having links to other pages

Thanks. For anyone who stumbles upon this, you need to use something like this...

  .config(function ($compileProvider) {
    $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|mailto|tel|ionic):/);
  })

Thank you @jamesdixon You saved my day. What was causing this error? Can you explain please?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

begbeder picture begbeder  路  5Comments

Git-Santhosh picture Git-Santhosh  路  5Comments

BorntraegerMarc picture BorntraegerMarc  路  5Comments

peterpeterparker picture peterpeterparker  路  6Comments

odecharette picture odecharette  路  4Comments