Possible Duplicate:
How to copy to the clipboard in JavaScript?
Suppose I have a webpage with this content:
<h1 id="foo"> Some string </h1>
Now I want to to copy Some string
to clipboard. But the conditions are:
- My webpage (app) is mouse oriented so I don't want to let the users to touch the keyboard.
- Right click is already engaged in another task, so I can't use right.
The only way is to hover over the <h1>
with id="foo"
and press left mouse button.
I googled it and found a JavaScript way to do this. But soon I knew that that's not cross browser. So, is there is way to copy text on left click of the hovered h1
.