If you want to add your website link in the text copied from your website then you can use the script given on this page. This technique does not protect your website data but helps you in spreading your website link through the copied text.
The java script to add your website link in the copied text is given below:
I personally used it several blogger blogs. You can add the above code just before </head> . It works perfectly like that in blogger code.
Spreading your link is a good thing to make your website popular. Adding this code can help you in attaining that target. Several people just copy paste text from your website without even noticing the link copied with it. You can utilize such copy-paste and spread your link by using this simple script.
Hope it will work for you !
The java script to add your website link in the copied text is given below:
<script type='text/javascript'>
function addLink() {
//Get the selected text and append the extra info
var selection = window.getSelection();
pagelink = ". Read more at: " + document.location.href;
copytext = selection + pagelink;
//Create a new div to hold the prepared text
newdiv = document.createElement('div');
//hide the newly created container
newdiv.style.position = 'absolute';
newdiv.style.left = '-99999px';
//insert the container, fill it with the extended text, and define the new selection
document.body.appendChild(newdiv);
newdiv.innerHTML = copytext;
selection.selectAllChildren(newdiv);
window.setTimeout(function () {
document.body.removeChild(newdiv);
}, 100);
}
document.addEventListener('copy', addLink);
</script>
I personally used it several blogger blogs. You can add the above code just before </head> . It works perfectly like that in blogger code.
Spreading your link is a good thing to make your website popular. Adding this code can help you in attaining that target. Several people just copy paste text from your website without even noticing the link copied with it. You can utilize such copy-paste and spread your link by using this simple script.
Hope it will work for you !
Hello Sir, is it possible to mix this script with the script you mentioned in your this post - http://bestrix.blogspot.com/2015/12/how-to-add-copy-button-under-some-text.html.
ReplyDeleteWhat I want is to add a copy button for some text in which it also add my url and a custom text.
Kindly let me know.