Created
October 22, 2023 16:02
-
-
Save sychou/5ef142e550a96e2bd1239e950bc15bcb to your computer and use it in GitHub Desktop.
Copy Noparam URL Bookmarklet
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(){ | |
var url = window.location.href; | |
var strippedUrl = url.split('?')[0]; | |
if (navigator.clipboard) { | |
navigator.clipboard.writeText(strippedUrl).then(function() { | |
console.log('URL copied to clipboard successfully!'); | |
}).catch(function(err) { | |
console.error('Could not copy URL: ', err); | |
}); | |
} else { | |
console.error('Clipboard API not supported.'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment