Error loading external URL in Phonegap 2.5 - ios

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.

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 !

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

Related

phonegap in ios simulator always displays popup

basically i gave my html + css + javascript code to my friend, asking him to compile it for phonegap in iOS. the same code works perfectly for android. however he said that everytime he compiled the code, popups will be displayed
here's the pop-up that he meant:
and
how do i remove those pop-ups?
I had the exact same issue, read the comment from codemonkey and discovered that in my html files, I was referring to an old cordova javascript file.
I replaced
<script src="js/cordova-2.2.0.js"></script>
with
<script src="cordova-2.5.0.js"></script>
and the popups disappeared :)

iOS Phonegap Infinite Dialog error when running application?

I'm having an issue developing a phonegap app for iOS. I just copied all the html / css / javascript markup into a phonegap application. I'm using xcode3 on a Mac with 10.6.8
When I go to run the application, I get these dialogs once it loads and install:
gap:["Network Status","getConnectionInfo","Network Status0",true]
usePolling: gap_callbackServer
getPort: gap_callbackServer:
getToken: gap_callbackServer:
Then is stays forever at gap_poll:
While I'm getting these dialogs, I can see the app's home screen all loaded in the background.
This application was successfully built, deployed and is currently on the App Marketplace for Android, never had problems like this developing for it.
What could be causing this?
More than likely you are using the Android version of phonegap.js. Each platform has it's own phonegap.js so you have to make sure you are using the right one. I know it is confusing but we are working on it.
Just change the script tag from:
<script type="text/javascript" src="cordova.2.0.0.js"></script>
to:
<script type="text/javascript" src="phonegap.js"></script>
Another solution that I found was to just use "phonegap.js" (and I don't even have that file included) and when I added my .zip file to build it seemed to automatically add the correct version for me. I noticed the phonegap getting started app didn't include an version of the .js file and that gave me the idea.
Main reason is for using the cordova.js which mainly for Android. I've searched the cordova-1.8.1.js for iOS, bad-luck for me.
And finally I create phonegap-1.8.1 project for iOS from terminal then tried to create another project with phonegap-2.1.0 from template and found the cordova-2.1.0.js. This JS then used for phonegap-1.8.1 project ...
I've got my success, now my application is running successfully on iOS 6(new version iPAD)

JQuery Mobile Icons Won't Load - Unless I Use the CDN

I'm working on my first PhoneGap app with JQuery Mobile and I've having a problem getting the included icons to show.
When I reference a local instance of the .css file, like so:
link rel="stylesheet" href="css/jquery.mobile-1.0.1.min.css" />
I don't get any icons. Just dark circles. I can see that the css is loading, because if I throw in a bogus path the results don't look like JQuery Mobile at all.
But when I reference a CDN, like so:
link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
I get nice buttons, no problems. I'm using Firefox to view output, but builds all the way onto an Android device show the same symptoms.
I'd punt and use the CDN, but I'm under the impression that if I want the app to run disconnected, then I should just include the .CSS file.
I've double checked my local CSS and downloaded it a second time, but no change. Anyone seen anything similar?
Make sure you have the jQuery Mobile images directory in the same directory as jquery.mobile-1.0.1.min.css.
I've just started with PhoneGap and had the same issue with JQuery Mobile.
Once I added the images under the www folder, I set the Build Action for each image to "Content." By default, mine were set to "Resource."
After this, the images appeared in my Windows Phone Emulator.
Hope this helps.
Chuck

jQuery Mobile - error loading pages using PhoneGap and WP7.5 - issue with security?

I have an app that runs fine using android phonegap 1.2 and jqm 1.0, and I'm attempting to port it to windows phone 7.5.
When the index.html page loads, the first thing is does is use a $.mobile.loadpage to load another html page. all i get on the wp7.5 app is the 'error loading page' message flash up briefly. if i put an href to the page on index.html i get the same error. to summarise:
running the index.html in a desktop browser works
running the app on android works
running the app on wp7.5 without calling another page works
jqm in ie (on wp7.5) can load other pages
if i link to a public jqm site from within the app, the public site works (ie jqm will load pages that are located on the www)
i have put $.support.cors = true; in the js code to enable cross site xhr requests
it seems to me that the only issue is when jqm tries to load a local file via ajax. i assume this has something to do with default security settings in the webbrowser control that phonegap uses?
can anyone shed any light on this?
I suspect this is WP7's insistence that all pages loaded from the "local website" are actually loaded from IsolatedStorage.
In the newer Phonegap / Cordova WP7 project templates there is a file maintained per build, CordovaSourceDictionary.xml which will do this for you.
Just make sure that whatever files you want to be able to navigate to / load (yes, you have to do it for images too) have a Build Actiion of "Content" in your project and when you build it, this xml will be updated automatically.
When your app runs the first thing Cordova does on WP7 is go through all the files in this XML file and copy them to isolatedStorage so they can be loaded / navigated to.

Firebug lite on iPad

Already found this page with some helpful hints.
Problem is I need to debug a web application on a CMS using an iPad and Safari.
So far I haven't been able to make firebug-lite work. I am working in a secured environment having no internet acces, but can copy files using a USB-key.
I have copied firebug-lite.js to the local server and included the file in a script tag in the head:
<script type="text/javascript" src="http://my_server/js/firebug-lite.js"></script>
Unfortunatly when I open the page in the CMS I cannot see the firebug-lite-button on the page. Verifying the source code firebug-lite should have been loaded on the page. There is no way to get a right click menu to inspect anything.
What can I do to make firebug-lite work on the iPad? What am I doing wrong?
Start Firebug Lite already opened, as per http://getfirebug.com/firebuglite#Options :
<script type="text/javascript" src="proto://path/to/firebug-lite.js#startOpened=true"></script>
I think you won't be able to inspect elements, but you can navigate to the elements in the DOM tree provided by Firebug Lite.
It looks like Firebug-lite has problems with the iPad browser since late 2010.
The problem (ticket on official tracker) has not been yet solved.
Have you tested the problematic page in Safari/Chrome/Chromium for desktop? Since they use Webkit, the same system used with mobile Safari/Chrome, you may be able to duplicate the error and find its solution. You can open Chrome's debugger with right click, Inspect element.

Resources