I am trying to make webpage very native. How to remove select,select all property in webpage?
This JavaScript will Disable select, copy and paste of the content But if user will save page to local machine they will be able to do "anything" they want with your code.
//disable cut copy past
var message = "";
function clickIE() { if (document.all) { (message); return false; } }
function clickNS(e) {
if(document.layers || (document.getElementById && !document.all)) {
if (e.which == 2 || e.which == 3) { (message); return false; }
}
}
if (document.layers)
{ document.captureEvents(Event.MOUSEDOWN); document.onmousedown = clickNS; }
else { document.onmouseup = clickNS; document.oncontextmenu = clickIE; }
document.oncontextmenu = new Function("return false")
//for disable select option
document.onselectstart = new Function('return false');
function dMDown(e) { return false; }
function dOClick() { return true; }
document.onmousedown = dMDown;
document.onclick = dOClick;
body {
-webkit-user-select: none;
-moz-user-select: -moz-none;
-ms-user-select: none;
user-select: none;
}
This is supported by Chrome, Safari, Firefox, IE 10, and iOS Devices. More info on MDN page.
Edit: If you want <input>
and <textarea>
to remain selectable in Firefox, add:
input,
textarea {
-moz-user-select: text;
}
$(document).on("contextmenu", function (event) { event.preventDefault(); });
You Can disable by adding attribute in your body tag oncontextmenu="return false;
<body oncontextmenu="return false;">
element_name{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
use this code https://www.docsity.com/it/teorie-e-pratiche-del-web-4/556038/
body, html{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
may this help you
<div onselectstart="return false;" style="-moz-user-select: none;">