Защита страницы от скачивания: выключем контекстное меню, выделение и Ctrl+S
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Защита страницы - в <head> страницы пишем <script src="protect.js"></script> | |
window.onload = function(){ | |
document.body.oncontextmenu= function(){return false;}; | |
window.addEventListener('selectstart', function(e){ e.preventDefault(); }); | |
document.addEventListener('keydown',function(e) { | |
if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
} | |
},false); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment