用js,html,css禁止复制网页内容

js写法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<script type="text/javascript">
function killCopy(e){
return false
}

function reEnable(){
return true
}

document.onselectstart=new Function ("return false")
if (window.sidebar){
document.onmousedown=killCopy
document.onclick=reEnable
}
</script>

 

html写法

1
<body ondragstart="return false" onselectstart="return false" oncontextmenu="return false">

 

css写法

1
2
3
4
5
6
7
/*----- Disable Text Selection with CSS Code-------*/
body {
-webkit-user-select: none !important;
-moz-user-select: -moz-none !important;
-ms-user-select: none !important;
user-select: none !important;
}

 

jquery写法

1
2
3
4
5
6
7
8
9
10
11
12
13
<script type="text/javascript">
$(document).ready(function () {
//Disable cut copy paste
$('body').bind('cut copy paste', function (e) {
e.preventDefault();
});

//Disable mouse right click
$("body").on("contextmenu",function(e){
return false;
});
});
</script>

 

坚持原创技术分享,您的支持将鼓励我继续创作!