问题
I would like to know how to put text into the clipboard like some popular websites are able to do. I have seen sites like www.photobucket.com and www.hulu.com somehow make copying to the clipboard automatic and cross browser. How can I do the same?
I saw a cross browser way to do it using flash, but it won't work with the current version?
回答1:
Take a look at this: http://ajaxian.com/archives/seeding-the-clipboard-in-flash10-with-zero-clipboard
回答2:
One option is Clippy, "a very simple Flash widget that makes it possible to place arbitrary text onto the client's clipboard.
回答3:
Well, since Firefox disables working with the clipboard in JS for security reasons, and you want cross browser support, it's not possible to get exactly what you want.
But really, sites like Photobucket don't do what you want and instead actually just select the entire textbox for you when you click it.
And a quick Google will help for finding how... here's one thing I found using the search terms javascript automatically select textbox
...
http://www.dynamicdrive.com/forums/archive/index.php/t-17992.html
来源:https://stackoverflow.com/questions/6486426/how-can-i-copy-a-message-to-clipboard-in-html