禁止复制网页内容的代码

所属分类:Javascript 2009-12-22,08:31 559 views

偶尔可能需要禁止别人复制网页里的内容,那么

将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()’>

1个评论 for "禁止复制网页内容的代码"

 

  1. 虫虫 说:

    呵呵..偶回来看看…现在的采集很让人伤心啊…. 采了也不留个地址…没有人性了

Leave a Reply