Skip to content

Instantly share code, notes, and snippets.

@davewasmer
Created May 1, 2020 16:41
Show Gist options
  • Select an option

  • Save davewasmer/a1443bd7df03d13d6279dee35db194e8 to your computer and use it in GitHub Desktop.

Select an option

Save davewasmer/a1443bd7df03d13d6279dee35db194e8 to your computer and use it in GitHub Desktop.
function copyUrlToClipboard() {
let url = getUrlThatICareAbout();
// Check the docs here, you'll need to pass in a DataTransfer object,
// so you'll need to lookup the docs for how to create one that captures
// the url string above.
// https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/write
navigator.clipboard.write(/* some DataTransfer object */)
}
let delay = /* however long you want to wait, in ms */
setTimeout(copyUrlToClipboard, delay);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment