Last active
February 1, 2021 14:54
-
-
Save defmech/8fd6d7906c4f99ed36779682aadfe00b to your computer and use it in GitHub Desktop.
A bookmarklet that copies the current tab's url to the clipboard. Tested in Safari and can be triggered by keyboard shortcut if `Use ⌘-1 to ⌘-9 to switch tabs` is disabled.
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
javascript: !(function (window, document) { | |
var tempTextArea = document.createElement("textarea"); | |
const copyText = document.getSelection(); | |
(tempTextArea.textContent = window.location.href), | |
document.body.appendChild(tempTextArea), | |
copyText.removeAllRanges(), | |
tempTextArea.select(), | |
document.execCommand("copy"), | |
copyText.removeAllRanges(), | |
document.body.removeChild(tempTextArea); | |
})(window, document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment