I had set up a Tampermonkey script below where if I press the Backspace key for more than 1 second in the URL https://www.google.com, I get a pop up notification. This works perfectly in the desktop Chrome browser for Windows. But in the Kiwi browser (android) with the same Tampermonkey script, pressing the backspace key in the android keyboard (Swiftkey) doesnt cause the popup to trigger. Where may be I am going wrong?
/* globals jQuery, $, waitForKeyElements */
// ==UserScript==
// @name Google HotKeys
// @version 0.1
// @include https://www.google.com/
// @require http://code.jquery.com/jquery-3.x-git.min.js
// @description personal
// @run-at document-end
// ==/UserScript==
var timer=false;
$('input').on({
keydown: function(e) {
var charCode = (e.which) ? e.which : event.keyCode, keyP;
if (charCode===8) keyP = 'Backspace';
if (charCode===80) keyP = 'P';
if (charCode===39) keyP = 'right';
if (charCode===40) keyP = 'down';
if (!timer) timer = setTimeout(function(){
clearTimeout(timer);
timer=false;
alert(keyP+' The key has been pressed for 1 second');
}, 1000);
},
keyup: function() {
clearTimeout(timer);
timer=false;
}
});