Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internal navigation rejected: <allow-navigation not set> in Cordova on iOS

I have built an iOS app using Cordova. The app tries to load a web page e.g. http://yourdomain.com/home in index.html. But, the page stays white blank with error in console "Internal navigation rejected - <allow-navigation> not set for url='http://yourdomain.com/home'".

I have already set <access origin="http://yourdomain.com/home" subdomains="true" /> and also tried by setting <allow-navigation> tag. But the page stays blank. am I missing anything else? Please guide.

After adding the following meta tag in index.html, the "internal navigation error" has gone, but the page is still white blank. :(

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script src: 'self' 'unsafe-inline' 'unsafe-eval'"> 
like image 615
Ravi Ranjan Singh Avatar asked Mar 26 '16 11:03

Ravi Ranjan Singh


2 Answers

I was having this problem and it turns out there are two config.xml files. The first one is in Xcode, but you have to edit the second one from the filesystem.

AppName/config.xml  AppName/platforms/ios/AppName/config.xml 

I added

<allow-navigation href="*" />  

to both of them and it worked. Using 6.3.0.

like image 183
Tom Kincaid Avatar answered Sep 17 '22 06:09

Tom Kincaid


You have to add this line to your config.xml

<allow-navigation href="http://yourdomain.com/home" /> 

or this one if you want to allow the navigation to all the urls on yourdomain.com

<allow-navigation href="http://yourdomain.com/*" /> 
like image 42
jcesarmobile Avatar answered Sep 20 '22 06:09

jcesarmobile