Few days ago, Firefox announced the support to
document.execCommand("copy") in the upcoming version 41.0 (currently in Beta). This change makes a step forward towards a Flash-free world (fallbacks are Flash based). Copying text selection to Clipboard is now available on all modern browsers, except Safari.
How it works
execCommand("copy") API is only available during a user-triggered callback (ie. a click). When triggered, it copies the current selection to the clipboard. Using is is very straightforward and just requires a couple of lines of code.
To keep it simple, most modern browers are supported, except Safari. It’s actually an huge lack, we hope will get fixed soon.
|Opera||>= 30 (release notes)|
|IE||>= 9 (allows it to be called at any time, but prompts a confirmation dialog)|
For more details, please check out caniuse.com.
You may also be interested in ...
- Chrome 54 introduces BroadcastChannel API and Spreaker is already using it
- Chrome changes "HTTPS with mixed content" icon and add Security tab to DevTools
- Who are we developing for?
- New Chrome security policy: powerful features will be removed on insecure origins
- Chrome Android 44+ introduces a new "related apps" banner