mjk39
mjk39

Reputation: 11

Copying link text as you click on it?

I have a website with various links on it. I would like to know if it is possible to code the links in a fashion where once a user clicks on the link, the link text is copied to the user's clipboard while the opening of the link is initiated.

Thanks in advance!

Upvotes: 0

Views: 237

Answers (2)

iConnor
iConnor

Reputation: 20189

This is possible but only reliable if you use flash which is a big downfall, there are libraries like zero clipboard that are good for this, but other than that its quite a tedious job. This cant be done cross browser with javascript

Upvotes: 0

Strikeskids
Strikeskids

Reputation: 4052

http://zeroclipboard.org/

You can use Zero Clipboard to do the copying and set the onclick handler of the link.

<a onclick="copyMyText(this)" href="url">Text here</a>

Upvotes: 1

Related Questions