Javascript Infused Bookmarks
Thu, Mar 20, 2025
I have often thought about writing my own browser plugin to manipulate CSS/DOM or automate tasks.
Today, I had to delete local storage very frequently while debugging a web application.
I thought it simply couldn’t be that I needed more than one click to delete a website’s data in the browser, not to mention installing a plugin for it.
I quickly asked GPT how to delete website data in the browser more efficiently. The result was predictably disappointing: use dev tools or browser settings. Somehow, my bookmark bar was smiling at me at that moment, so I asked GPT if it was possible to delete all data of the current tab with a bookmark.
Et voilà, bookmarks can execute JavaScript—why didn’t I think of that earlier? Just add a new bookmark and inject your JavaScript code as a URL. A JavaScript-infused bookmark is called a bookmarklet (ill-named, in my opinion).
The format is always:
Before saving your code to the bookmark, make sure to minify the script and remove any comments.
My use cases so far
Autofill credentials
Bypass paywalls with archive.is
Delete local storage data of the current tab
This works for my needs so far.
Be aware that cookie handling could be improved.
Bypass annoying website overlays
Since I refuse to use tracking banners that don’t provide a direct opt-out option, bookmarklets are a perfect way to make these websites more user-friendly.
Without comments.
Website defacing locally in browser
If you want to quickly change the text of a website for screenshots etc., this can come in very handy. Changes will vanish on reload.
Bookmarklets in action
