0

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!

mjk39
  • 11

2 Answers2

1

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>

Strikeskids
  • 3,932
  • 13
  • 27
  • Thanks, Looking into ZeroClipboard at the moment. Seems like the only decent cross-browser solution out there. And yes, I and looking for both a copying of the link text, while also initiating a href. – mjk39 Jul 04 '14 at 14:16
0

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

iConnor
  • 19,997
  • 14
  • 62
  • 97