Monday, June 3, 2024
190
rated 0 times [  194] [ 4]  / answers: 1 / hits: 77244  / 15 Years ago, mon, november 30, 2009, 12:00:00

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.


More From » cross-browser

 Answers
13

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.


[#98198] Wednesday, November 25, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
renag

Total Points: 22
Total Questions: 97
Total Answers: 95

Location: Albania
Member since Sun, Nov 22, 2020
4 Years ago
;