Last active
March 27, 2025 17:22
-
-
Save error9900/a88650bba0f9b6a96d4c31ad9aa9d05d to your computer and use it in GitHub Desktop.
Miscellaneous bits of JavaScript potentially useful for bookmarklets
This file contains hidden or 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
// https://en.wikipedia.org/wiki/Bookmarklet | |
// https://en.wikipedia.org/wiki/URL#Syntax | |
// https://developer.mozilla.org/en-US/docs/Web/API/Location | |
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator | |
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard | |
// Clean URL | |
// Copy just the origin and pathname from the current URL to the clipboard, | |
// then browse to that "clean" URL, i.e. remove query(s) and fragment(s) | |
javascript:clean_url=location.origin+location.pathname;navigator.clipboard.writeText(clean_url);location.href=clean_url;false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment