Tag: backlink

How to add a Read More link on your content when someone copy pastes it

Everyone copy pastes!

Every day people copy and paste paragraphs, quotes and anything else you can imagine from one place to another online. Copy pasting has become one of the most common elements of social media as well because we all love to share something we think is cool with our friends. When was the last time You copy pasted something? Chances are you still have that data on your clipboard.

Get backlinks on copied content

How to add copyright read more link back to your site on copy paste text
At this very moment hundreds of thousands of people are sharing something via email, social networks, blogs and messenger apps by copy and pasting information. Wouldn’t it be awesome if your website would somehow automatically add a read more link along with the text that someone copies from your site?

It turns out there is an incredibly easy way to do this! All you need to do is add the following code just before your closing head tag. (it looks like this: </head>)

 

Copy and paste this code:

<script>
function addLink() {
//Get the selected text and append the extra info
var selection = window.getSelection(),
pagelink = '<br /><br /> Read more at: ' + document.location.href,
copytext = selection + pagelink,
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’ve turned the part that you can modify yourself red within the code so it’s easier to see. Just change that to whatever you like or remove it altogether to only have a link under the copied text. It’s up to you! The only thing you should keep are the <br /> tags otherwise the link will be added on the same line as the copied text and it makes it kind of annoying.

Note: I didn’t come up with the code myself. The original article can be found on StackExchange

Share!