Menonaktifkan aktivitas cut copy paste pada konten web

Umumnya pengguna internet dapat mengambil informasi atau konten narasi dengan cari copy paste. Tetapi , kita dapat meminimalisirnya dengan menambahkan menambahkan javascript berikut pada halaman web kita.

function disableSelection(a) {
void 0 !== a.onselectstart ? a.onselectstart = function() {
return !1
} : void 0 !== a.style.MozUserSelect ? a.style.MozUserSelect = "none" : a.onmousedown = function() {
return !1
}, a.style.cursor = "default"
}
window.onload = function() {
disableSelection(document.body)
}, document.oncontextmenu = function(a) {
var b = a || window.event;
if ("A" != (b.target || b.srcElement).nodeName) return !1
}, document.ondragstart = function() {
return !1
}, window.addEventListener("keydown", function(a) {
!a.ctrlKey || 65 != a.which && 66 != a.which && 67 != a.which && 70 != a.which && 73 != a.which && 80 != a.which && 83 != a.which && 85 != a.which && 86 != a.which || a.preventDefault()
}), document.keypress = function(a) {
return a.ctrlKey && (65 == a.which || 66 == a.which || 70 == a.which || 67 == a.which || 73 == a.which || 80 == a.which || 83 == a.which || 85 == a.which || a.which), !1
}, document.onkeydown = function(a) {
if (a = a || window.event, 123 == a.keyCode || 18 == a.keyCode) return !1
};

Comments

Popular posts from this blog

Addon untuk form input secara autocomplete text dengan typeahead.js

Contoh Penerapan Barcode di Surat Tanda Terima Order

Share Contoh Serangan SQL Injection