ad_728x90

參觀我的【 伊生活小舖】

2013年7月5日 星期五

How to add automatic link source when others copy a content from blog

Log in to your Blogger account


  • Go to Design option--> Edit HTML
  • Find (CTRL+F)  </head> tag.
  • Copy the below code, and paste it above </head> tag.

<script type='text/javascript'>
function addLink() {
    var body_element = document.getElementsByTagName('body')[0];
    var selection;
    selection = window.getSelection();
    var pagelink = "<br/><br/> Original Content from: <a href='"+document.location.href+"'>"+document.location.href+"</a><br/>Copyright © C_M_YES Web Studio."; // change this if you want
    var copytext = selection + pagelink;
    var newdiv = document.createElement('div');
    newdiv.style.position='absolute';
    newdiv.style.left='-99999px';
    body_element.appendChild(newdiv);
    newdiv.innerHTML = copytext;
    selection.selectAllChildren(newdiv);
    window.setTimeout(function() {
        body_element.removeChild(newdiv);
    },0);
}document.oncopy = addLink;
</script>
  • Change RED colour with your own words.
  • Save it..


COMMENTS HAVE BEEN DISABLED FOR THIS POST [文章的評論已被禁用]

Ratings and Recommendations by outbrain