Hi,
I’m trying to disable the hightlighting and/or the context menu on iOS.
The following works on Android but not iOS. What am I doing wrong? I’m using the 2.0 version of the InAppBrowser.
InAppBrowser.ExecuteJS("document.addEventListener('contextmenu', event => event.preventDefault());");
InAppBrowser.ExecuteJS("document.documentElement.style['-webkit-user-select'] = 'none';");
InAppBrowser.ExecuteJS("document.documentElement.style['-webkit-touch-callout'] = 'none';");
InAppBrowser.ExecuteJS("document.getElementById(\"user\").addEventListener('contextmenu', event => event.preventDefault());");
InAppBrowser.ExecuteJS("document.getElementById(\"user\").onmousedown = function(ev){if(ev.detail > 1){var e = event || window.event;e.preventDefault && e.preventDefault();e.stopPropagation && e.stopPropagation();e.cancelBubble = true;e.returnValue = false;return false;}};");
InAppBrowser.ExecuteJS("var last = Date.now();document.getElementById(\"user\").ontouchstart = function(e){var count = e.touches.length;if (count > 1) { return; }var now = Date.now(),delta = now - (last || now);touch = e.touches ? e.touches[0] : e; doubleTap = (delta > 0 && delta <= 1500);if(doubleTap){return false;}last = now;};");
InAppBrowser.ExecuteJS("(function loopingFunction() {var el = document.getElementById(\"user\");if(el.selectionStart != el.selectionEnd){el.selectionEnd = el.selectionStart;}setTimeout(loopingFunction, 100);})();");