Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Cordova allow-navigation overridden by allow-intent

We want every link on the app to be able to be opened in the external browser on the system, with the exception of a selection of hostnames.

We tried putting <allow-navigation href="*.hostname.com/*"/> , but this gets overridden when you use <allow-intent href="http://*/*" /> and <allow-intent href="https://*/*" as the intent tags for all the other links in the app.

The expected result would be our hostnames being opened within the app, but they open on the external browser instead.

I've tried looking at all the recent documentation and help available on the net, but could not find an answer to my solution. Hope you guys know.

Edit: forgot to mention we run the latest cordova CLI and the latest whitelist plugin with the inappbrowser plugin.

Sincerely,

Daniel

like image 819
Thrinaria Avatar asked May 10 '16 13:05

Thrinaria


1 Answers

Try changing your <allow-*> tags to this:

<allow-intent href="*.hostname.com/*"
<allow-navigation href="https://*/*"
<allow-navigation href="http://*/*"
<allow-access href="https://*/*"
<allow-access href="http://*/*"

The <allow-navigation> tag is for controlling urls the Cordova webview itself can be navigated to.

Look at this article for a better understanding on Cordova's Whitelist.

like image 153
johnborges Avatar answered Oct 05 '22 11:10

johnborges