Earlier quoted context omitted.
Interestingly running this in the console works but from a bookmarklet changes all the page content to false,false,false,.... (on firefox) Any idea?
Change map to forEach?
A bookmarklet to kill sticky headers (2013)
61–70 of 91 posts
Re: A bookmarklet to kill sticky headers (2013)
#62Love it! Since it's now 2025, we probably should search for "fixed" & "sticky" Here's a minified version with "sticky" added: javascript:(()=>[...document.querySelectorAll('body *')].map(el=>["fixed","sticky"].includes(getComputedStyle(el).position)&&el.remove()))();
Interestingly running this in the console works but from a bookmarklet changes all the page content to false,false,false,.... (on firefox) Any idea?
Re: A bookmarklet to kill sticky headers (2013)
#63So it works by removing elements with "position: fixed". But do all sticky headers work like that? In sites that I build, I tend to just have a normal div at the top, followed by a div for the main body with "overflow-y: scroll".
`position: sticky` or `fixed` are the only acceptable techniques to implement sticky headers for typical websites. (There are definitely app scenarios where you need multiple scroll areas and don't want any of them to use the document scroll area, e.g. a multi-pane email client; in such cases you should then manage focus just a little so one pane gets focus when everything loses it.)
Re: A bookmarklet to kill sticky headers (2013)
#64Anecdote: I was in charge of a complete rebuild for an e-commerce website a few years back, which included a new design. We were debating various layout options, as it was tricky to get the information hierarchy right and show everything necessary even on smaller screens. Then we had an internal review and the CEO complicated things considerably by insisting it was very important that the header be sticky --- to ensu…
Is it possible to distract the kid in power with a favicon that is always visible in the url bar and allow users not curse the brand due to stickiness?
Re: A bookmarklet to kill sticky headers (2013)
#65I've been using the Kill-Sticky Chrome extension for years: https://chromewebstore.google.com/detail/kill-sticky/lekjlgf... Because it has a configurable keyboard shortcut. Can't imagine browsing the web without it. At this point hitting Cmd+K when I visit an article is pure reflex. A bookmarklet would be more secure, but I don't know of a way to assign keyboard shortcuts to one.
Re: A bookmarklet to kill sticky headers (2013)
#66Re: A bookmarklet to kill sticky headers (2013)
#67Earlier quoted context omitted.
Interestingly running this in the console works but from a bookmarklet changes all the page content to false,false,false,.... (on firefox) Any idea?
Firefox expects your script to return undefined, so you can add one at the end (or even shorter: void 0).
Re: A bookmarklet to kill sticky headers (2013)
#68This doesn't completely eliminate sticky headers/footers (problematic when you actually want to use them), but they behave like normal elements at the start/end of the page (instead of the screen).
I initially did it this way for technical reasons, but now I kind of prefer it to what mainstream browsers do.
[0]: https://git.sr.ht/~bptato/chawan/tree/e56399f92d2323f9af95e0... (not a great explanation - it says "bottom", but like "position: absolute" it's placed at the top if only "top" is specified, etc.)
Re: A bookmarklet to kill sticky headers (2013)
#69Bookmarklet aficionado and maintainer of bookmarkl.ink here. Took the liberty of posting this bookmarklet: https://bookmarkl.ink/ashtonmeuser/849a972686e1505093c6d4fc5...
Re: A bookmarklet to kill sticky headers (2013)
#70Earlier quoted context omitted.
Firefox expects your script to return undefined, so you can add one at the end (or even shorter: void 0).
Thank you (and neighbors), I didn't know this.
People often disable this by making the last expression `void 0`, which evaluates to `undefined`. This is really an anachronism, though, the original point wasn’t actually brevity (it’s only one character shorter after URL encoding, not worth funky syntax) but that just writing `undefined` was broken and sometimes didn’t evaluate to the special value undefined. That’s fixed now, so I would just append `undefined` instead.
Though, really what you should do is always wrap bookmarklets in IIFEs, which avoids stomping around the page’s global variables, lets you write code with early exits, lets you opt back in with an explicit return rather than editing boilerplate, and also solves this issue as a bonus.