Saturday 1 September 2012

Add A Copyright Notice To Copied Text

Important: All scripts hosted on widcraft.googlecode.com don't work anymore because Google has blocked that SVN repository.

I use tynt tools for my other blogs which add a copyright text and post link into all text visitors copy from my blog and i thought that there would be some trick to do this without using tynt. While searching it on Google i found one post about it on Bavotasan , which i'am going to share with you guys.

It's easy and you can do this in your html documents/blogger/wordpress and every single thing which supports HTML and JavaScript. One more thing that this script doesn't support IE so i suggest you to download Google Chrome.

Below is the script

<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 &#169; Widget Craft"; // 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>

That's.....If you're copying content from any site please respect their copyrights.
Important: Check our new website TricksPanda.com for WordPress tutorials, plugins and more.
 
Powered by Blogger.