4 ms·
For the record you don't actually need to depend on new APIs like "document.execCommand('copy')", simply shifting focus to an off-screen textbox area when ctrl
by Mahn 10y ago
For the record you don't actually need to depend on new APIs like "document.execCommand('copy')", simply shifting focus to an off-screen textbox area when ctrl is down will do the trick in 95% of the cases, with full cross browser compatibility.
- Mandatum 10y ago.. Not sure this would work in OSX.
- onion2k 10y agoJust use event.metaKey as well as CTRL.
- Houshalter 10y agoMost people copy text with right click, which would be unaffected by that. Also mobile browsers.
- Mahn 10y agoI don't know that most people do that, but right click and mobile seem to bypass OP's method as well.