Hi hope someone can can help im having a problem with how ripple is dealing with for loops when emulating an android app using html5 css jquery and jqtouch

simple loop

var len = 1;
for (i = 0; i <len; i++){
alert('foo');
}

run it through chrome all is well as expected;

run it through ripple (phonegap);

I get 6 alerts;

found some stuff saying it may be a bug in ripple and to change the device but still got the problem!!!!!

has anyone come across this and know a work around.

cheers in advance

Niall

You could try the following diagnostic tests:

  1. Change alert("foo"); to alert(len); . Does it alert the right value? If you see "6" then you may be victim of persistent caching (an earlier version of your code).
  2. Try running the code within a onload = function(){...} structure. If you still get 6 alerts, then it would appear that the window.onload event fires 6 times.
  3. Remove the loop, leaving len=1; alert(len); . If you still get 6 alerts, then it would appear that the emulator loads the page (or at least the javascript) 6 times.

Airshow