作者:
2008-12-23 23:45
访客复制博客文章自动加上 版权信息。
对于版权保护基本都是靠自觉,防复制是没用的。
尤其是 出现 Hprsnap 这样可以抓文字的软件以后。
干扰码也有 屏蔽它的转帖器了。
把以下代码加到 模板的 底部 适当位置
JavaScript代码
- <script type="text/javascript">
- document.body.oncopy = function () {
- setTimeout( function () {
- var text = clipboardData.getData("text");
- if (text) {
- text = text + "本文来自: 飘飞的落叶's blog "+location.href; clipboardData.setData("text", text);
- }
- }, 100 )
- }
- </script>
以前 pjblog 有一个文章水印插件跟这个差不多,代码如下
JavaScript代码
- <script defer>
- document.body.oncopy=new Function("setTimeout(addData,300);");
- document.oncopy=new Function("setTimeout(addData,300);");
- function addData()
- {
- var d = window.clipboardData.getData('Text');
- window.clipboardData.setData('Text',d+"原文网址:"+document.location.href);
- }
- </script>