I am using Ripple 0.9.9 to test my PhoneGap 2.0 app but am having trouble setting it up. I've read related questions on this site, but nothing which addresses my issues:
According to phonegap deviceready event - ripple emulator - the ripple emulator injects ripple.js into the page and this contains the phonegap api emulator. So, don't include your phonegap.js/cordova.js in your page when testing inside Ripple.
Using <body onload="onLoad()">
to call my onload handler I have the following JavaScript:
var mobile=false;
function onLoad() {
console.info("inside onload...");
var uA = navigator.userAgent;
if (uA.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)) {
console.info("on phone: " + navigator.userAgent);
document.addEventListener("deviceready", function() { mobile=true; appReady(); }, false);
} else {
if (uA.match(/Chrome/)) {
console.info("on browser: " + navigator.userAgent + ", do not initiate mobile app for Chrome since will be init. by Ripple");
} else {
/* not running on Chrome so no Ripple */
appReady();
}
}
}
When I run my index.html inside of the Ripple emulator (set to Phonegap/Cordova 2.0) running on an iPhone 4 I see the following debug (init.js is my js file) :
inside onload... init.js:19
on browser: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko)
Chrome/23.0.1271.64 Safari/537.11, do not initiate mobile app for Chrome since will be init. by Ripple init.js:26
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.) ripple.js:475
cordova :: Initialization Finished (Make it so.) ripple.js:475
inside onload... init.js:19
on phone: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/1A542a Safari/419.3
I can see that the onload event is fired twice: a) for the normal browser and b) it seems that ripple changes the user-agent to that of an iPhone 4 and then reloads the page.
Is this normal behaviour?
The 'deviceready' event is never called. Any idea why not?