0

My simulator now opens up the web page in a different tab (as in the screenshot). I haven't tested it on real device yet. I want it be launched automatically when the user opens the app. My js file looks like this:

document.addEventListener("deviceready", onDeviceReady, false);

//Activate :active state
document.addEventListener("touchstart", function() {
}, false);

function onDeviceReady() {
  var app;
  navigator.splashscreen.hide();
  app = new Application();
  app.run();
}

function Application() {
}

Application.prototype = {

run: function() {
    var that = this,
        openExternalInAppBrowser = document.getElementById("openExternalInAppBrowser");
        openExternalInAppBrowser.addEventListener("click", that.openExternalInAppBrowser);
},

openExternalInAppBrowser:  function () {
    window.open("https://www.khanacademy.org", "_blank");
},
}

KhanAcademy is just an example. Now I want to remove that "Click me" button and open automatically. I couldn't find any suitable event from the events list. So, can you explain to me how auto-launch that page as a welcome page in the app and not in different tab but in the app? enter image description here

kenkulan
  • 147
  • 4
  • 14
  • Couldn't you just add `window.open("https://www.khanacademy.org", "_blank");` to your `onDeviceReady` function? – Rob Lauer Jul 20 '16 at 20:39
  • @RobLauer thanks, I was testing on simulator and nothing showed up. So I assumed it wasn't working, now I tested on a real device and adding window.open() in onDeviceReady works. – kenkulan Jul 21 '16 at 03:32

0 Answers0