Black_Star,
код устарел и мало полезен.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Closed Site</title>
<script>
"use strict";
//запрещает выделение мышкой и комбинации клавиш Ctrl + A и Ctrl + U и Ctrl + S
function preventSelection(element) {
var preventSelection = false;
function addHandler(element, event, handler) {
if (element.attachEvent) element.attachEvent('on' + event, handler);
else if (element.addEventListener) element.addEventListener(event, handler, false);
}
function removeSelection() {
if (window.getSelection) {
window.getSelection().removeAllRanges();
} else if (document.selection && document.selection.clear)
document.selection.clear();
}
//запрещаем выделять текст мышкой
addHandler(element, 'mousemove', function () {
if (preventSelection) removeSelection();
});
addHandler(element, 'mousedown', function (event) {
var event = event || window.event;
var sender = event.target || event.srcElement;
preventSelection = !sender.tagName.match(/INPUT|TEXTAREA/i);
});
//запрещаем нажатие клавищ Ctrl + A и Ctrl + U и Ctrl + S
function killCtrlA(event) {
var event = event || window.event;
var sender = event.target || event.srcElement;
if (sender.tagName.match(/INPUT|TEXTAREA/i)) return;
var key = event.keyCode || event.which;
if ((event.ctrlKey && key == 'U'.charCodeAt(0)) || (event.ctrlKey && key == 'A'.charCodeAt(0)) || (event.ctrlKey && key == 'S'.charCodeAt(0))) // 'A'.charCodeAt(0) можно заменить на 65
{
removeSelection();
if (event.preventDefault) event.preventDefault();
else event.returnValue = false;
}
}
addHandler(element, 'keydown', killCtrlA);
addHandler(element, 'keyup', killCtrlA);
}
preventSelection(document);
</script>
</head>
<body>
<h1>If you see this sentence, that mean something go wrong !</h1>
</body>
</html>