by takinola on 3/27/25, 12:00 AM with 11 comments
Post current web page to HN
javascript:window.location="http://news.ycombinator.com/submitlink?u="+encodeURIComponent(document.location)+"&t="+encodeURIComponent(document.title)
Find Archive.is link javascript:window.location="http://archive.is/newest/"+document.location
by ashtonmeuser on 4/4/25, 4:37 PM
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.
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.
Enjoy!
by SonuSitebot on 4/4/25, 12:32 PM
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?
by tompark on 3/27/25, 12:50 PM
I beefed up the 'kill sticky' one <https://news.ycombinator.com/item?id=32998091> but that's not very interesting. Here are some other ones:
* Re-enable zoom on iPhone (for pages that disable it)
javascript:document.querySelector('meta%5Bname=viewport%5D').setAttribute('content','width=device-width,initial-scale=1.0,maximum-scale=10.0,user-scalable=1');
* Open same page in new tab with js script tags removed (you must click to allow it to open a new tab) 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)();
* Show page source 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)();
* Re-enable long-press context menu (for pages that disable it) javascript:(function()%7Bdocument.oncontextmenu=null;window.oncontextmenu=null;%7D)();
* Re-enable text selection (for pages that disable it) javascript:(function()%7B;document.onselectstart=null;document.onselectchange=null;document.ondragstart=null;document.onmousedown=null;window.ontouchstart=null;window.ontouchend=null;%7D)();
by spidersenses on 3/27/25, 4:53 PM
javascript:(function(){ if (location.hostname === "www.reddit.com") { location.href = location.href.replace("www.reddit.com", "old.reddit.com"); }})();
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.
by hboon on 3/27/25, 2:14 AM
javascript:(function(){window.scrollTo({top:document.body.scrollHeight,behavior:'smooth'});})();
Scroll to bottom x 10: 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})();
Skip YouTube video ad: 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)();
by perilunar on 3/27/25, 11:24 AM
Convert fixed position to absolute:
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';}}})();
Convert sticky position to absolute: 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';}}})();
Though looking at them now I should combine and update them.by fouc on 3/27/25, 7:44 AM
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.
by jackiefeng on 3/27/25, 1:55 AM