Skip to main content

jQuery Mobile onDeviceReady event for Desktop

If you have tried reviewing your mobile app on a desktop and have issues with the onDeviceReady trigger, than the below code will be helpful to you.

//JavaScript
//*******************
if(window.device){
    document.addEventListener("deviceready", onDeviceReady, true);
}else{
    onDeviceReady();
}
//*******************

the “window.device” check will enable you to see if the current system is a device or a regular desktop.

Please note, in future the device reference may also include desktop tablets. Use this code accordingly to your system.