Update 4 Oct 2015, this ugly flash workaround is now obsolete thanks to clipboard.js.
I recently worked on a web app that present code snippets to the user, so I though it would be nice to have a “copy to clipboard” feature. Saving a few clicks is always welcome!
The most common way is to use an invisible flash movie, which means it won’t work on a mobile devise (and you need to handle it gracefully).
I will use ZeroClipboard, which is the most popular library that implement this flash hack.
To make it looks nice I will use Bootstrap