Skip to content

Instantly share code, notes, and snippets.

@melvinram
Created August 5, 2017 21:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melvinram/4c423749d7e3fdbe5de56b21d5081473 to your computer and use it in GitHub Desktop.
Save melvinram/4c423749d7e3fdbe5de56b21d5081473 to your computer and use it in GitHub Desktop.
Copy Cookies To Clipboard
javascript:(function(){ var textArea = document.createElement("textarea"); textArea.style.position = 'fixed'; textArea.style.top = 0; textArea.style.left = 0; textArea.style.width = '2em'; textArea.style.height = '2em'; textArea.style.padding = 0; textArea.style.border = 'none'; textArea.style.outline = 'none'; textArea.style.boxShadow = 'none'; textArea.style.background = 'transparent'; textArea.value = document.cookie; document.body.appendChild(textArea); textArea.select(); try { var successful = document.execCommand('copy'); var msg = successful ? 'successful' : 'unsuccessful'; console.log('Copying text command was ' + msg); } catch (err) { console.log('Oops, unable to copy'); } document.body.removeChild(textArea); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment