Cordova inappbroswer does not launch on window.open

270 views Asked by At

Default browser launches when I call window.open instead of using the inappbrowser to run the page within the application. Using Cordova 5.0 and inappbrowser is 1.0. Cordova.js is included withing the appropriate dir but still not working. I've tried creating a new project and re-installing the plugin with no luck. Anything I am doing wrong? Been spending hours trying different things with no success.

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="css/index.css">
</head> 


    <body onload= window.open('http://apache.org', '_blank', 'location=yes');>
    <script type="text/javascript" src="../platforms/android/assets/www/cordova.js"></script>
    </body>
</html>
1

There are 1 answers

0
ffmsingh On

Hi I had the same problem this is how i implemented my application, after loading all the default javascripts put somthing like this at the bottom of your file.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    window.open = cordova.InAppBrowser.open;
}

function loadSite()
{
    var ref = window.open('http://www.tutorialspoint.com/', "_self", "location=no,zoom=no,hardwareback=no");
}
loadSite();