I\'m using phonegap 2.4.0 to create an Android and iOS App.
Now I recognized that the onclick event in links is fired twice inside the Android App using Android 4.2.
I was facing the exact same issue, but my app/game needed the user to be able to double tap, on touchstart. So the scirra solution mentioned above wasn't usable as a required delay of 500 or 1000 ms kills the doubletap.
After some digging I noticed a difference between the first (user) tap and the second (bug) tap:
event.originalEvent.touches
isn't available in the second bug tap. So I wrote this bug detection helper which solved my case:
function isDoubleTapBug (e) {
// only handle touch events (in case your listener works on mouse events too)
if (!'ontouchstart' in document.documentElement))
return false;
if (!e.originalEvent.touches) {
e.preventDefault();
e.stopPropagation();
return true; // indicate to caller that it's a bug
}
return false;
}
Then in your listener, do this:
document.addEventListener('touchstart', function (e) {
if (isDoubleTapBug(e))
return false;
// now do your actual event handling stuff...
}