Window.open () does not work in iOS application using phone space

I am writing an ios application using Phonegap, all I need in my application is that when a phone delay causes index.html the html page will redirect the user to my website the fact is that html does not redirect the application to my the site, I don’t if on the phone close the safari, I just need to redirect it to my site, my code is:

<html> <head> <script type="text/javascript"> function loadlink() { window.open("www.cnn.com"); } </script> </head> <body onload="loadlink()"> </body> </html> 
+6
source share
2 answers

Make your function like this:

 function loadlink() { window.location.href = "www.cnn.com"; } 
+3
source

Or even better

 function loadlink() { if (typeof (window.open) == "function") { window.open("http://www.stackoverflow.com"); } else { window.location.href = "http://www.stackoverflow.com"; } } 

Since Internet Explorer doesn't really like using window.location.href

+3
source

Source: https://habr.com/ru/post/922159/


All Articles