开发者

HTML files does not work on Desktop browser after including phonegap.js

I am developing an application for Android using phonegap. When I include phonegap.js file in my html, it does not work on desktop browser like Firefox or chrome. I know that phonegap.js provides the bridge between Android's native functionalities and HTML/javascript.

I need to know is there any way so that my html files work fine on desktop browser also even if using phonegap.js because it is very difficult to debug js application on Android so I am searching some way so that it can work on Firefox, if phone related functionalities don't wor开发者_如何学Gok then it is fine, I just need to debug the application.

NOTE: If I remove "phonegap.js" from html, it works fine on desktop browsers, but not able to communicate to server and so only screens appear but dada doesn't.

Thanks


Just like Erik's comment above says, you are probably triggering your application initialization on the deviceready event. This is fired by native device code, so won't be available in a desktop browser.

On Android, you can manually trigger the deviceready event like so:

window.addEventListener('load', function() {
    PhoneGap.onDeviceReady.fire();
}, false);

On the other platforms, you can instantiate your own custom deviceready event and dispatch it on the document.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜