How to: Add a Copyright Notice to Copied Text

Some of you may noticed a copyright info and a reference link to the source, at the bottom of a copied text content from this site. Yea it’s copy protected!. I get a lot of mails asking about this magic. So I’d like to reveal the secretes behind this magic.

This is not a big magic thing. I just simply running a JavaScript function for this magic. This function grab the copied content, insert a copyright notice and then add to the clipboard. Thanks to c.bavota for his great script. According to the developer, this function will work for all major browsers except Internet Explorer.

Here is the Magic.Just copy this script and paste it into the “<head> </head>” tags.

function addLink() {
	var body_element = document.getElementsByTagName('body')[0];
	var selection;
	selection = window.getSelection();
// change this if you want
	var pagelink = "

Read more at: <a href=""+document.location.href+"">"+document.location.href+"</a>
Copyright ©";
	var copytext = selection + pagelink;
	var newdiv = document.createElement('div');'absolute';'-99999px';
	newdiv.innerHTML = copytext;
	window.setTimeout(function() {
document.oncopy = addLink;