四種查看路徑:
查看效果:猛戳
1、直接按F12
2、Ctrl+Shift+I查看
3、鼠標點擊右鍵查看
4、Ctrl+u=view-source:+url
把以上三種狀態都屏蔽掉就可以了,document有onkeydown(鍵盤按鍵事件),該事件里面找到對應的keycode並處理就可以,
document也有oncontextmenu鼠標右鍵事件,屏蔽即可。4里面的Ctrl+u是可以屏蔽的,【但是如果你在URL前面加上view-source:后刷新還是可以看的^_^】
JS擼碼如下:
window.onload=function(){ document.onkeydown=function(){ var e=window.event||arguments[0]; if(e.keyCode==123){ alert("小樣你想干嘛?"); return false; }else if((e.ctrlKey)&&(e.shiftKey)&&(e.keyCode==73)){ alert("還是不給你看。。"); return false; }else if((e.ctrlKey)&&(e.keyCode==85)){//追加
return false;
} }; document.oncontextmenu=function(){ alert("小樣不給你看"); return false; } }