Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When copying automatically add URL

Tags:

html

I have seen on few websites that when you copy some text from there, and paste anywhere, it will add the URL of the page from where I copied the text.

For example:

This is text I copied.

and when I paste, I get:

This is text I copied.
Read more: http://example.com/abc/def

I'm just curious to know how this is done? How to add additional text in the copied text?

Example: Check this question (or any other) on answers.com. Copy the question text and paste. Tested with Firefox latest version.

like image 738
user966585 Avatar asked Oct 07 '11 06:10

user966585


2 Answers

There are many online tools which provide this and other website/blog management utilities. Answer.com is also using one such service named tynt. Open the link, scroll down to the bottom and you can see answer.com in featured clients ;). For more information.

like image 159
Umer Hayat Avatar answered Oct 19 '22 10:10

Umer Hayat


Zeroclipboard should help you modify the clipboard content. It's a flash movie that is hidden in the browser and exposes a JavaScript API to access the clipboard.

Example.

var clip = new ZeroClipboard.Client();
clip.addEventListener('complete', function(client, text) {
    clip.setText(text + "Read more at www.");
});
like image 27
sissonb Avatar answered Oct 19 '22 09:10

sissonb