Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

window.open() does not work on iOS app using phone gap

I am writing an ios app using Phonegap, all i need in my app is that when the phonegap call the index.html the html page will redirect the user to my web site the thing is that the html does not redirect the app to my site, i do not care if the phone gap open the safari i just need it 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>
like image 835
user723686 Avatar asked Aug 05 '12 12:08

user723686


1 Answers

Make your function look like this:

function loadlink() {
  window.location.href = "www.cnn.com";
}
like image 116
Strelok Avatar answered Nov 02 '22 07:11

Strelok