Chrome bookmarklets allow you to type javascript instead of a standard website url.
We can use this to do some fun and useful things. Either make a new bookmark and in the URL field, type this in, or you should be able to copy and drag the text into the bookmark tab as well (you’ll see a plus sign). You can run many (vanilla) JS functions and code within your bookmarklets, but there are some issues with escape characters and formatting.
You can do most of these commands via chrome extensions or AutoHotKeys, but I prefer bookmarklets because they don’t use nearly as much processing power as extensions, are only active once clicked, and are more privacy friendly. This means that you can run a script on a page with a single click, know what code is running and also can see what it logs via the console!
Picture is from searching “JavaScript” in Dall-E
javascript:
void(location.href='https://web.archive.org/web/*/'+escape(location.href.replace(/^https?:\/\//, %27%27).replace(/\/$/, %27%27)));
javascript:var url = window.location.href;
window.location.href="https://web.archive.org/save/" + url;
javascript:var url = window.location.href;
window.location.href="https://archive.ph/" + url;
javascript: var p=r(); function r(){var g=0;var x=false;var x=z(document.forms);g=g+1;var w=window.frames;for(var k=0;k<w.length;k++) {var x = ((x) || (z(w[k].document.forms)));g=g+1;}if (!x) alert('Password not found in ' + g + ' forms');}function z(f){var b=false;for(var i=0;i<f.length;i++) {var e=f[i].elements;for(var j=0;j<e.length;j++) {if (h(e[j])) {b=true}}}return b;}function h(ej){var s='';if (ej.type=='password'){s=ej.value;if (s!=''){prompt('Password found ', s)}else{alert('Password is blank')}return true;}}
javascript: document.location = document.URL.replace('reddit.com','removeddit.com');
javascript: var rndInt = Math.floor(Math.random() * 9) + 1;
for(var i = 0; i<10000; i++)
{
window.scrollBy(0, 600 + rndInt); console.log(i);
}
I wanted to add another useful bookmarklet to erase cache and cookies for any specific website, but unfortunately due to security policies it won’t work…
What you could do alternatively, is to either have it copy the url into your cliboard and then manually open the page… or potentially make your own chrome extension with it.
javascript: document.location="chrome://settings/siteData?searchSubpage="+document.location.hostname
I hope you found these as useful as I do! Please tweet me if you have any ideas, comments or feedback!