Search code examples
ibm-mobilefirstworklight-mbs

window.open addEventListener does not work on "Mobile Browser Simulator"


I'm using IBM Worklight 6.2

I'm using window.open to load some external pages for OAuth and I configure event listeners for the opened window.

var authWindow = window.open(authUrl, '_blank', 'location=yes');

authWindow.addEventListener('loaderror', function(e) {  
    console.log(">> load error. event: " + JSON.stringify(e));
});

also for "load" and "loadstart" events.

This works in Android and iOS but when I preview the app in the "Mobile Browser Simulator" the eventListeners are not executed.

I have also tested creating a "desktopbrowser" application.

Any idea?


Solution

  • Loaderror, loadstart, and loadstop are specific to Cordova and not supported in the Mobile Browser Simulator. It would be best to test these on emulator or device. Please see: http://cordova.apache.org/docs/en/3.0.0/cordova_inappbrowser_inappbrowser.md.html#addEventListener