I\'m trying to do a simple alert(\'test\') app, but the event isn\'t being fired, this is the code:
function onLoad() {
document.addEventListener("de
This works in Cordova apps (tested on iOS and Android) and ordinary web pages. No library (jQuery) needed.
// Use onDeviceReady if we run in Cordova
window.addEventListener('load', function(){
if (window.Cordova) {
document.addEventListener('DeviceReady', bootstrap, false);
} else {
bootstrap();
}
}, false);
The Cordova documentation says that the DeviceReady event is made so, that it can't be missed. The handler will be called even if the device was ready before.