Error loading external URL in Phonegap 2.5

青春壹個敷衍的年華 提交于 2019-12-10 14:43:49

问题


I created a new Phonegap 2.5 project from scratch, and I've been trying to load an external URL in it, but I keep getting input boxes popping up on startup before loading the actual URL. I first get a pop-up with the URL of the website, then in the input box it says "DeviceInfo","Device652321624". If I click Cancel, it pops up 2 more times before loading the website. On the website itself, it loads some relative URLs, but others cause the entire page to refresh and the input boxes to pop up again.

I set the URL by setting <content src="http://phonegap.example.com" />, which is just a regular website with Javascript. I even tried commenting out all Phonegap specific code (no more ondeviceready calls), but it still causes the problem. http://www.google.com loads for me, so I'm not sure what else to check. And it works with the Android version that I've developed.

If it helps, I've also seen this message in the XCode log: Resetting plugins due to page load.


回答1:


I've had the exact same problem today. I fixed it by checking the include of the cordova.js file (this js is generated when you create the project using the create command. ( called cordova.js in the renamed cordova project version. probably phonegap.js in phonegap ?)

anyway my include was :

<script type="text/javascript" src="js/cordova.js"></script>

whereas je js file was in the project root :

I changed it to

<script type="text/javascript" src="cordova.js"></script>

and every things is fine now.

also, the 'create' command for Android generate a different js file. make sur that the new one generated for ios is used.

hope that helps !




回答2:


Problem is you are using android's cordova.js instead of ios's cordova.js. Just make sure you are using the proper one.



来源:https://stackoverflow.com/questions/15402447/error-loading-external-url-in-phonegap-2-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!