I just stumble on a piece of code which I never saw before:
document.execCommand('Copy');
which seems to copy the clipboard contents to the element in focus.
Is this functionality available cross-browser?
I found a page that shows a compatibility matrix for document.execCommand
.
This is for 'design mode' where the browser effectively turns the document into an editor. The execCommand API originated with IE and was later added to HTML5. Exactly which commands are supported, as well as their behavior varies across browsers. Clipboard access is considered a security risk.