-
-
Save hallvors/8589631 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var btn = document.getElementById("copy-button"); | |
btn.addEventListener("click", clickHandler, false); | |
function clickHandler(e) { | |
document.exeCommand('copy'); | |
} |
Good point @JamesMGreene - updated gist, still wondering if we could get around that stupid gotcha.. :-(
(Synthetic events were not the way to go - document.execCommand('copy') is the old new thing)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NOTE: You must also call
preventDefault
on theClipboardEvent
instance or the data won't successfully be put into the system/desktop clipboard.