For example, when I select a block of text from a lyrics website (MetroLyrics), then paste it somewhere else, there is a blurb of text added that advertises the website I copied the text from:
Hast du etwas Zeit für mich?
Dann singe ich ein Lied für dich
Von neunundneunzig Luftballons
Auf ihrem Weg zum Horizont
Denkst du vielleicht grad an mich?
Dann singe ich ein Lied für dich
Von neunundneunzig Luftballons
Und dass sowas von sowas kommt
Read more: Nena - 99 Luftballons (german) Lyrics | MetroLyrics
How could I go about doing something similar when users copy and paste text from one of my sites?
I know JavaScript can't directly manipulate the clipboard in some/most cases, so is there some text that gets inserted/added when the user selects a block of text to copy?
document.addEventListener('copy', function (e) {
var selection = window.getSelection();
e.clipboardData.setData('text/plain', $('<div/>').html(selection + "").text() + "\n\n" + 'Source: ' + document.location.href);
e.clipboardData.setData('text/html', selection + '<br /><br />Source: <a href="' + document.location.href + '">' + document.title + '</a>');
e.preventDefault();
});
I found this on How to add extra info to copied web text
Is this what you are looking for?