开发者

Crossbrowser technique for adding HTML content to the user's clipboard

Suppose Stackoverflow wanted to make an easy "Copy link to this question" link. When you clicked this link on What is your best programmer joke?, it would add this HTML to your clipboard:

<a href="https://stackoverflow.com/questions/234075">What is your best programmer joke?</a开发者_StackOverflow>

So when you pasted into Gmail or whatever, it would look like this: What is your best programmer joke?

What's the best way to accomplish this in a cross-browser fashion?


First off, cross browser copy to clipboard has been a pain for while. Here is a good solution http://zeroclipboard.org/.

Note, that you are trying to copy HTML or rich text so pasting into notepad for instance will give you the full HTML. It should work as you want if you paste into rich text editor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜