Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error loading external URL in Phonegap 2.5

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.

like image 216
Waynn Lue Avatar asked Oct 22 '22 14:10

Waynn Lue


1 Answers

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 !

like image 122
Guian Avatar answered Oct 30 '22 23:10

Guian