Search code examples
ioscordovahybrid-mobile-appphonegap

Cordova - window.open doesn't work on IOS


I can't open link in my cordova app on IOS When I use

window.open('http://maps.apple.com/?q='+label, '_system');

But it works with (but not in the browser) :

window.location.href = 'http://maps.apple.com/?q='+label;

In my config.xml I whitelist this :

<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />

And in my index.html :

<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: content:">

I really don't understand the problem..

Thanks


Solution

  • In my iOS Cordova apps the window.open() works only if the event is related to a touch not to an automated event like onDeviceReady() or setTimeout().

    Executing the window.open after an onclick() event works fine.