Phonegap 2.4.0 with Android 4.2 - strange double click behaviour

android, cordova, double-click, onclick

Solution

Using a temporary solution from scirra.com

last_click_time = new Date().getTime();
document.addEventListener('click', function (e) {
    click_time = e['timeStamp'];
    if (click_time && (click_time - last_click_time) < 1000) {
        e.stopImmediatePropagation();
        e.preventDefault();
        return false;
    }
    last_click_time = click_time;
}, true);

Problem

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.2 on a Nexus 4 device, like a double click (althoug I tapped it only once!). ``` <a href="#" onclick="$(this).append('test'); return false;" style="some styles...">some text</a> ``` libs in use: - jquery 1.9.1 - jquery mobile 1.3.0 (rc) - jquery ui 1.10.0 - jquery touch punch 0.2.2 - phonegap 2.4.0 After I clicked (or tapped) the link on my Nexus 4 (Android 4.2.2) the string 'test' is appended twice inside the app. This does NOT happen when I test it as mobile web app directly in the android browser. It also works on my Samsung S3 (Android 4.1.2) inside the app. No problem on iPhones, too. Anyone else recognized this strange behavior? (and maybe was able to fix it? ;-) )

Original source