禁止复制网页内容的代码
偶尔可能需要禁止别人复制网页里的内容,那么
将body改为以下代码就可以实现网页内容不被复制,当然只能防止直接的方式,查看源代码,右键还是可以用。
如果对方使用采集的话,也没什么效果。。
<body oncontextmenu=’return false’ ondragstart=’return false’ onselectstart =’return false’ onselect=’document.selection.empty()’ oncopy=’document.selection.empty()’ onbeforecopy=’return false’ onmouseup=’document.selection.empty()’>
Filed under:Javascript | 1 Comment