禁止用户使用“检查元素”功能的方法很简单,只需要在自己的网站底部文件中加上以下的JS代码即可。
<script>function oppos(){
window.close();
window.location="about:blank"
}
function hehe(){
if((window.console&&(console.firebug||console.table&&/firebug/i.test(console.table())))||(typeof(opera)=='object'&&typeof(opera.postError)=='function'&&console.profile.length>0)){
oppos();
}
if(typeof(console.profiles)=="object"&&console.profiles.length>0){
oppos();
}
}
if(top.location!=self.location)top.location=self.location;
if(window!=window.top){
window.top.location.replace(window.location)
}
hehe();
window.onresize=function(){
if((window.outerHeight-window.innerHeight)>200)oppos()
}
shortcut.add("Ctrl+U",
function(){
oppos();
});
shortcut.add("Ctrl+Shift+S",
function(){
oppos();
});
shortcut.add("Ctrl+S",
function(){
oppos();
});</script>