Allen 2020-05-20 21:55:21 12610 0 0 0 0

网页中禁止复制,禁止右键菜单


<!-- Tao Add 禁止复制 --> 

<body topmargin="0" oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()">


+++

禁止网页另存为:在<body>后面加入以下代码: 

<noscript> 

<iframe src="*.htm"></iframe> 

</noscript> 

(好像不管用)


+++

禁止右键菜单

<script type="text/javascrpt" language="javascript">

//方法一

function noMenuOne()

{

alert('禁止右键菜单!');

return false;

}

document.oncontextmenu = noMenuOne;


//方法二

function noMenuTwo()

{

if(event.button == 2)

{

alert('禁止右键菜单!');

return false;

}

}

document.onmousedown = noMenuTwo;

</script>


+++

禁止复制(Ctrl+C)

<script type="text/javascript" language="javascript">

function noCopy()

{

alert("禁止使用Ctrl+C进行复制操作!");

event.returnValue = false;

}

</script>

//<body oncopy = "noCopy()">


+++

禁止缓存 在页面中使用HTML标记,如下面:

<HEAD>

<META http-equiv=Pragma content=no-cache>

<META http-equiv=Cache-Control content=no-cache>

<META http-equiv=Expires content=0>

</HEAD>



Tag: 网页编程 javascrpt
我也要发一个   ·   返回首页   ·   返回[Html]   ·   前一个   ·   下一个
欢迎评论
未登录,
请先 [ 注册 ] or [ 登录 ]
(一分钟即可完成注册!)
返回首页     ·   返回[Html]   ·   返回顶部