Following jquery is not working in my android webview. When long press on a span for more than 10 seconds it needs to be redirected to a specific url, this is working on site but not working on android webview.
$(function() {
var longpress = 10000;
var start;
jQuery("#restart").on('mousedown', function(e) {
start = new Date().getTime();
});
jQuery("#restart").on('mouseleave', function(e) {
start = 0;
});
jQuery("#restart").on('mouseup', function(e) {
if (new Date().getTime() >= (start + longpress)) {
alert('long press!');
$("#restart >a").attr("href", "http://siteurl/?key=gesture")
} else {
alert('short press!');
}
});
});
Are you using a touchscreen? If so you may need to use 'touchstart' and 'touchend'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With