您的位置:首页 > 编程语言

禁止网页复制的代码

2017-04-25 17:08 176 查看
今天做一网站项目时,客户要求让用户不能复制网站内容,网上搜索了一下,总结成以下二几行代码。其实吧,要是懂的人,这些都是浮云来的,客户就是要让一般人不能复制他的内容资料。

01
<
script
 
type
=
text
/javascript>
02
<!--
03
document.oncontextmenu=new Function('event.returnValue=false;');
04
document.onselectstart=new Function('event.returnValue=false;');
05
-->
06
</
script
>
07
<!DOCTYPE html PUBLIC "-//W3C
08
//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
09
<
html
 
xmlns
=
"http://www.w3.org/1999/xhtml"
>
10
<
head
>
11
<
meta
 
http-equiv
=
"Content-Type"
 
content
=
"text/html; charset=gb2312"
 
/>
12
<
13
title
14
>禁止网页复制的代码</
title
>
15
</
head
>
16
<
body
 
style
=
"text-align:center"
>
17
<
p
> </
p
>
18
<
p
> </
p
>
19
<
p
>网页禁止右键、禁止查看源代码、禁止复制的代码,试试你的右键、ctrl+c和ctrl+c吧~
20
  
<
SCRIPT
 
language
=
javascript
 
type
=
text
/javascript>
21
<!--
22
document.oncontextmenu=new Function('event.returnValue=false;');
23
document.onselectstart=new Function('event.returnValue=false;');
24
-->
25
  
</
SCRIPT
>
26
</
p
>
27
</
body
>
28
</
html
>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: