如何实现别人在我的网站上复制文章时自动加上版权的功能?

如何实现别人在我的网站上复制文章时自动加上版权的功能?
答:在文章页模板中(</body>  这里 </body>)加入如下代码,然后再 html 更新就可以了。

<script type="text/javascript">
document.body.oncopy = function () { setTimeout( function () { var text = clipboardData.getData("text"); if (text) { text = text + "\r\n本篇文章来源于 生活参考网|www.shckw.COM 原文链接:"+location.href; clipboardData.setData("text", text); } }, 100 ) }
</script>


100%(1)

0%(0)
发表评论?

2 条评论。

  1. document.body.oncopy=function(){
    event.returnValue=false;
    var t=document.selection.createRange().text;
    var s=”本文转自软天下,原文地址:”+location.href;
    clipboardData.setData(‘Text’,'\r\n’+t+’\r\n’+s+’\r\n’);
    }

    红色文字可修改成你自己想要的文字,
    本文来自软天下,详细完整内容地址:http://www.ruantianxia.com/xueyuan/show.asp?id=339

  2. 这个方法对于 wordpress 同样适用,加到 foot.php 模板的 /body 前面即可!

发表评论

*