title: Onload event fires twice and deviceready does not fire at all
body: <p>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:</p>
  
  <p>According to <a href="https://stackoverflow.com/questions/5187089/phonegap-deviceready-event-ripple-emulator">phonegap deviceready event - ripple emulator</a> - 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.</p>
  
  <p>Using <code>&lt;body onload="onLoad()"&gt;</code> to call my onload handler I have the following JavaScript:</p>
  
  <pre><code>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();
      }
  }
  
  }
  </code></pre>
  
  <p>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) :</p>
  
  <pre><code>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 
  </code></pre>
  
  <p>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.</p>
  
  <p>Is this normal behaviour?</p>
  
  <p>The 'deviceready' event is never called. Any idea why not?</p>