Here are a couple bookmarklets I find myself using often:<p>Post current web page to HN<p><pre><code> javascript:window.location="http://news.ycombinator.com/submitlink?u="+encodeURIComponent(document.location)+"&t="+encodeURIComponent(document.title)
</code></pre>
Find Archive.is link<p><pre><code> javascript:window.location="http://archive.is/newest/"+document.location</code></pre>
For anyone stumbling upon this that deals with bookmarklets, I submit bookmarkl.ink[0], a tool I made to ease the maintenance of bookmarklets.<p>In short, it pulls code from GitHub Gists (which have the benefit of being backed by git repos), transpiles, minifies, bundles, and wraps in an IIFE. It's also got a basic module resolver that allows you to include libraries or remote files.<p>This allows you to use creature comforts like TS and libraries and maintain code readability while still ending up with the smallest possible bookmarklet. It also allows you to link to a particular version (git hash), present user-defined variables, edit code in an inline editor, etc.<p>Enjoy!<p>[0]: <a href="https://bookmarkl.ink" rel="nofollow">https://bookmarkl.ink</a>
1. At sitebot, we focus on AI-driven solutions for businesses, but these bookmarklets remind me how simple automation can make life easier. Has anyone experimented with AI-powered bookmarklets, like quick content summarization or auto-filling forms based on context?<p>2. As someone who works across frontend and backend development, I still find bookmarklets incredibly useful for quick debugging and automation. While browser restrictions have tightened, tools like Tampermonkey or custom browser extensions can still help power users retain control. What are some creative ways you've found to keep bookmarklets alive?
Oh it's nice to see productivity ones. I mostly use bookmarklets on my phone to fix annoyances bc on a desktop browser you can just open the js console or inspector.<p>I beefed up the 'kill sticky' one <<a href="https://news.ycombinator.com/item?id=32998091">https://news.ycombinator.com/item?id=32998091</a>> but that's not very interesting. Here are some other ones:<p>* Re-enable zoom on iPhone (for pages that disable it)<p><pre><code> javascript:document.querySelector('meta%5Bname=viewport%5D').setAttribute('content','width=device-width,initial-scale=1.0,maximum-scale=10.0,user-scalable=1');
</code></pre>
* Open same page in new tab with js script tags removed (you must click to allow it to open a new tab)<p><pre><code> javascript:(window.openPageWithoutScripts=async%20function()%7Bconst%20resp=await%20fetch(window.location.href);const%20text=await%20resp.text();const%20doc=new%20DOMParser().parseFromString(text,'text%2Fhtml');doc.querySelectorAll('script').forEach(script=%3Escript.remove());const%20w=window.open();w.document.head.innerHTML=doc.head.innerHTML;w.document.body.innerHTML=doc.body.innerHTML;%7D)();
</code></pre>
* Show page source<p><pre><code> javascript:(function()%7Bvar%20a=window.open('about:blank').document;a.write('%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3Ctitle%3ESource%20of%20'+location.href+'%3C/title%3E%3Cmeta%20name=%22viewport%22%20content=%22width=device-width%22%20/%3E%3C/head%3E%3Cbody%3E%3C/body%3E%3C/html%3E');a.close();var%20b=a.body.appendChild(a.createElement('pre'));b.style.overflow='auto';b.style.whiteSpace='pre-wrap';b.appendChild(a.createTextNode(document.documentElement.innerHTML))%7D)();
</code></pre>
* Re-enable long-press context menu (for pages that disable it)<p><pre><code> javascript:(function()%7Bdocument.oncontextmenu=null;window.oncontextmenu=null;%7D)();
</code></pre>
* Re-enable text selection (for pages that disable it)<p><pre><code> javascript:(function()%7B;document.onselectstart=null;document.onselectchange=null;document.ondragstart=null;document.onmousedown=null;window.ontouchstart=null;window.ontouchend=null;%7D)();</code></pre>
As a Reddit user I'm using this simple replace function to switch to the old.reddit.com version of a page:<p>javascript:(function(){ if (location.hostname === "www.reddit.com") { location.href = location.href.replace("www.reddit.com", "old.reddit.com"); }})();<p>Necessary due to Google search results on Reddit leading to the new.reddit.com version of a page which demands a login more often than not.
Scroll to bottom:<p><pre><code> javascript:(function(){window.scrollTo({top:document.body.scrollHeight,behavior:'smooth'});})();
</code></pre>
Scroll to bottom x 10:<p><pre><code> javascript:(function(){%20let%20count%20=%200;%20const%20interval%20=%20setInterval(()%20=>%20{%20window.scrollTo({%20top:%20document.body.scrollHeight,%20behavior:%20'smooth'%20});%20count++;%20if%20(count%20>=%2010)%20clearInterval(interval);%20},%201000);%20})();
</code></pre>
Skip YouTube video ad:<p><pre><code> javascript:(function()%7Bvar%20skipButton=document.querySelector('button.ytp-ad-skip-button-modern');if(skipButton)%7BskipButton.click();%7Delse%7Bdocument.querySelector('video').currentTime=document.querySelector('video').duration;%7D%7D)();</code></pre>
I hate sticky and fixed page headers, so these two are handy:<p>Convert fixed position to absolute:<p><pre><code> javascript:(function(){var%20i,%20elements=document.querySelectorAll('body%20*');for%20(i=0;%20i<elements.length;%20i++)%20{if%20(getComputedStyle(elements[i]).position%20==='fixed'){elements[i].style.position='absolute';}}})();
</code></pre>
Convert sticky position to absolute:<p><pre><code> javascript:(function(){var%20i,%20elements=document.querySelectorAll('body%20*');for%20(i=0;%20i<elements.length;%20i++)%20{if%20(getComputedStyle(elements[i]).position%20==='sticky'){elements[i].style.position='absolute';}}})();
</code></pre>
Though looking at them now I should combine and update them.
Bookmarklets are effectively dead, unless they're extremely simple or you use Firefox. It's kinda ridiculous that they've been effectively blocked by changes to browsers (like chromium-based ones) that make it nearly impossible to run JavaScript from the address bar, along with "Content Security Policy" rules that enable widespread blocking of inline scripts.<p>It's unfortunate that browser developers want to fully derisk all potential security holes, because that also means removing the choice from the end user. This ends up being security by infantilization.