1、右键禁用
方法1:
document.oncontextmenu = function () {
return false;
}
方法2:
document.onmousedown = function () {
if (event.button == 2) {
return false;
}
}
2、复制禁用
<script>
function noCopy()
{
event.returnValue = false;
}
</script>
<body oncopy = "noCopy()">
3、另存为禁用
在<body>内容主体中加入<noscript><iframe src='*.html'></iframe></noscript>
4、缓存禁用
<head>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
</head>
5、F12禁用
方法1:
document.onkeydown = function (e) {
var currentKey = 0, k = e || window.event;
currentKey = k.keyCode || k.which || k.charCode;
if (currentKey == 123) {
window.event.cancelBubble = true;
window.event.returnValue = false;
}
}
方法2:
document.onkeydown = function () {
if (window.event && window.event.keyCode == 123) {
window.event.returnValue = false;
}
}
评论