添加全局禁止F12开发者工具,
f12.js
function prohibit_f12_func(){ //瑜版捇 document.onkeydown = function() { //F12 if(window.event && window.event.keyCode == 123) { window.event.keyCode = 0; window.event.returnValue = false; } //Ctrl+U if(event.ctrlKey && window.event.keyCode == 85) { window.event.returnValue = false; } //缁備焦Ctrl+S if(event.ctrlKey && window.event.keyCode == 83) { window.event.returnValue = false; } } // //鐏炲繗 document.oncontextmenu = disable; function disable(event) { if(window.event) { event = window.event; } try { var the = event.srcElement; if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { return false; } return true; } catch(e) { return false; } }}prohibit_f12_func()
function prohibit_f12_func(){ //瑜版捇 document.onkeydown = function() { //F12 if(window.event && window.event.keyCode == 123) { window.event.keyCode = 0; window.event.returnValue = false; } //Ctrl+U if(event.ctrlKey && window.event.keyCode == 85) { window.event.returnValue = false; } //缁備焦Ctrl+S if(event.ctrlKey && window.event.keyCode == 83) { window.event.returnValue = false; } } // //鐏炲繗 document.oncontextmenu = disable; function disable(event) { if(window.event) { event = window.event; } try { var the = event.srcElement; if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { return false; } return true; } catch(e) { return false; } }}prohibit_f12_func()
- function prohibit_f12_func(){ //瑜版捇鏁惄妯诲瘻娑撳妞 document.onkeydown = function() { //缁備焦F12 if(window.event && window.event.keyCode == 123) { window.event.keyCode = 0; window.event.returnValue = false; } //缁備焦Ctrl+U閺屻儳婀呭┃鎰敩閻拷 if(event.ctrlKey && window.event.keyCode == 85) { window.event.returnValue = false; } //缁備焦Ctrl+S缂冩垿銆夐崣锕鐡ㄦ稉锟 if(event.ctrlKey && window.event.keyCode == 83) { window.event.returnValue = false; } } // //鐏炲繗鏂閸欐娊鏁懣婊冨礋 document.oncontextmenu = disable; function disable(event) { if(window.event) { event = window.event; } try { var the = event.srcElement; if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) { return false; } return true; } catch(e) { return false; } }}prohibit_f12_func()