Last active
September 10, 2020 00:48
-
-
Save adam-zethraeus/a44fc966758a4c90facb8098233cb48a to your computer and use it in GitHub Desktop.
a bookmarklet to copy a url to the current page, with the current selection highlighted. (Chrome only. Because other browser care about timing attacks more than your Google search result experience.)
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: | |
let tempInput = document.createElement("input"); | |
tempInput.value = window.location.href + `#:~:text=${window.getSelection().toString()}`; | |
document.body.appendChild(tempInput); | |
tempInput.select(); | |
document.execCommand("copy"); | |
document.body.removeChild(tempInput); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment