php禁止复制网页内容功能

xiaoxiao2021-02-28  85

1、在不想被复制内容的php页面中添加引用<script src="../nocopy.js" type="text/javascript"></script>

2、同时在网站文件夹中放入nocopy.js文件,当前../nocopy.js表示nocopy.js文件在根文件夹中

3、nocopy.js中的文件内容是:

var omitformtags=["input", "textarea", "select"] omitformtags=omitformtags.join("|")

function disableselect(e){ if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1) return false }

function reEnable(){ return true }

if (typeof document.onselectstart!="undefined") document.onselectstart=new Function ("return false") else{ document.οnmοusedοwn=disableselect document.οnmοuseup=reEnable }
转载请注明原文地址: https://www.6miu.com/read-85606.html

最新回复(0)