博客文章复制自动加版权信息

Posted on June 29th, 2008 by wanglb, under Wordpress.

对于WordPress系统来说,编辑themes下的模板文件single.php,在适当的位置加入以下代码即可。

  1. <script type=”text/javascript”>
  2. document.body.oncopy=function(){
  3. event.returnValue=false;
  4. var t=document.selection.createRange().text;
  5. var s=”本文来源于<?php bloginfo(’name’); ?> <?php echo get_settings(’home’); ?> , 原文地址: <?php the_permalink() ?> “;
  6. clipboardData.setData(’Text’,'\r\n’+t+’\r\n’+s+’\r\n’);
  7. }
  8. </script>

这样,当别人复制你文章内容的时候,系统会自动将版权信息和原文地址加入到复制内容中

Trackback URL

Leave a Comment

Tags

广告赞助

Recent Posts

Clicki