Android: Disable Text Selection in a Webview

Android: Disable text selection in a webview

I figured it out!! This is how you can implement your own longtouchlistener. In the function longTouch you can make a call to your javascript interface.

var touching = null;
$('selector').each(function() {
this.addEventListener("touchstart", function(e) {
e.preventDefault();
touching = window.setTimeout(longTouch, 500, true);
}, false);
this.addEventListener("touchend", function(e) {
e.preventDefault();
window.clearTimeout(touching);
}, false);
});

function longTouch(e) {
// do something!
}

This works.

Disable text selection in WebView on WP8.1

This can be achieved by using JavaScript or CSS. Here's the answer from MSDN forums which addresses this issue. Hope this helps.

<html onselectstart="return false;" style="-ms-user-select: none;">
...
</html>


Related Topics



Leave a reply



Submit