HTML页面内容禁止选择,复制,右键
刚在一个看一个站点的源代码的的时候发现的,其实原来真的很简单
,
& lt; body leftmargin=0,页面顶栏=0,oncontextmenu事件=& # 39;return 假# 39;,ondragstart=& # 39; return 假# 39;,onselectstart =& # 39; return 假# 39;,onselect=& # 39; document.selection.empty () & # 39;, oncopy=& # 39; document.selection.empty () & # 39;, onbeforecopy=& # 39; return 假# 39;,onmouseup=& # 39; document.selection.empty() & # 39;在
关键就在,
oncontextmenu事件=& # 39;return 假# 39; ondragstart=& # 39; return 假# 39;, onselectstart =& # 39; return 假# 39;, onselect=& # 39; document.selection.empty () & # 39;, oncopy=& # 39; document.selection.empty () & # 39;, onbeforecopy=& # 39; return 假# 39;, onmouseup=& # 39; document.selection.empty () & # 39;
一个更简单的方法就是在& lt; body>中加入如下的代码,这样鼠标的左右键都失效了只
页面顶栏=?“,oncontextmenu事件=皉eturn false", ondragstart=皉eturn false", onselectstart =皉eturn false", onselect=癲ocument.selection.empty ()“, oncopy=癲ocument.selection.empty ()“, onbeforecopy=皉eturn false", onmouseup=癲ocument.selection.empty ()“
1。禁止网页另存为:在& lt; body>后面加入以下代码:,
& lt; noscript>, https://www.yisu.com/zixun/& lt; iframe  src=" * . htm ">
2。禁止网页内容复制。粘贴:在& lt; body>中加入以下代码:,
& lt; body onmousemove=/HideMenu ()/, oncontextmenu事件=皉eturn false", ondragstart=皉eturn false", onselectstart =皉eturn false", onselect=癲ocument.selection.empty ()“, oncopy=癲ocument.selection.empty ()“, onbeforecopy=皉eturn false", onmouseup=癲ocument.selection.empty()“在