Allen 2020-05-20 21:55:21 12261 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>



【版權聲明】
本文爲原創,遵循CC 4.0 BY-SA版權協議!轉載時請附上原文鏈接及本聲明。
原文鏈接:https://tdlib.com/am.php?t=F5znhqHw92zw
Tag: 网页编程 javascrpt
我也要發一個   ·   返回首頁   ·   返回[Html]   ·   前一個   ·   下一個
歡迎評論
未登錄,
請先 [ 註冊 ] or [ 登錄 ]
(一分鍾即可完成註冊!)
返回首頁     ·   返回[Html]   ·   返回頂部