Add a reference to your website in copied content

You would have noticed that when you copy some text from some websites then it appends a back reference in that copied text. It is mainly done in content rich websites like article directories or blogs. Whenever anyone copies text from those websites, reference to original website is added in clipboard and finally when user pastes the copied content, a reference to original website also gets pasted. You can use this method in your blog/websites, in the tutorial we will discuss how easily it can be achieved.


You can do this with little jQuery code given below:

<script type="text/javascript">
function addLink() {
 var body_element = document.getElementsByTagName('body')[0];
 var selection;
 selection = window.getSelection();
 var pagelink = "<br /><br /> Read more at: <a href='"+document.location.href+"'>"+document.location.href+"</a><br />Copyright yourwebsite"; // change this
 var copytext = selection + pagelink;
 var newdiv = document.createElement('div');'absolute';'-99999px';
 newdiv.innerHTML = copytext;
 window.setTimeout(function() {
document.oncopy = addLink;

Reference for above script.

Just few lines of javascript code will do your job. Now lets understand what this little js does. Whehn you copy this script in your page head section it takes control over whole content between <body> tags. Now when user copies content this script appends a pagelink (its a variable and its value is set to your websites link) at the end of content. So content from your website and a link to your website is copied in the clipboard.

If you don’t want interfere with JS in your website I have another option for you. There is a good jQuery plugin named copyright which does same job.  You can download this plugin from here and use it in your website. Let me know your thoughts on this method of adding back reference to your website with copied content.

About sanjeev

Dreamer, Blogger and Thinker. I love to help people in solving their problems. You can also join me HERE

Related posts: