How to fire deviceready event in Chrome browser (trying to debug phonegap project)

前端 未结 9 443
太阳男子
太阳男子 2020-12-23 16:09

I\'m developing a PhoneGap application and I\'d like to be able to debug it in Chrome rather than on the phone. However, I do the initialization of my code in an onDeviceRe

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-23 17:00

    I use Safari for debugging and do this:

    //my standard PG device ready
    document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {
    //debug("onDeviceReady")
    getDefaultPageSetup();
    
    }
    
    //then add this (for safari
    window.onload = function () {
    if(! window.device)
        onDeviceReady()
    }
    

提交回复
热议问题