How to not consent to cookies
May 27, 2020.You know, I really appreciate the innovative feel of all those “This page uses cookies” banners, all featuring a huge button “Understood” or “Agree”. I marvel at my wealth of user choice when I see the lack of a “Disagree” button.
I don’t want to burden these wonderful sites, you know? Clicking that Agree button fires quite a lot of tracking requests to… whatever hundred trackers that were birthed into existence this week. And isn’t that a huge load on the network?
Not to mention that by having cookies, I’m basically forcing the site to cross-reference and identify me for ad targeting purposes, which must be an utterly exhausting task for some database server somewhere. Ever open a phone book?
I bet it would be good for “User Retention” too, if 40% of my very limited screen space wasn’t blocked by a banner. I’ve learned a thing or two in my web design courses, and I think blocking half the screen for people who don’t hit Agree counts is not good UX or something. Isn’t good UX something sites care about?
Gosh, it would be such a good thing to do for the web if we could just have Disagree buttons on these cookie banners.
The real Disagree button was the friends we made along the way
One day a tech code programmer friend linked me to the Kill Sticky Headers bookmarklet by Alisdair McDiarmid. A bookmarklet is like a bookmark on your browser, except clicking it runs code or opens some data URI rather than taking you to a bookmarked website. This bookmarklet basically runs this code:
[...document.querySelectorAll("body *")]
.filter(elem => getComputedStyle(elem).position.match(/fixed|sticky/))
.forEach(elem => elem.parentNode.removeChild(elem));
meaning “outright delete every element that’s displayed with position: fixed
or position: sticky
”.
Apparently this includes
- banners that follow you as you scroll down
- sidebars that follow you as you scroll down
- social media sharing buttons that follow you as you scroll down
- a lot of modals, like “Subscribe to my newsletter today” popups
- cookie consent banners that follow you as you scroll down
outright delete… cookie consent banners…
Ah, so the Disagree button was in the bookmarks bar all along!
I’m an emacs user at heart
Jokes aside, the above is a perfectly workable solution for disagreeing with cookie banners. You get your screen space without having to click Agree and triggering some JavaScript that does who-knows-what.
It’s actually not what I use today, because I no longer use a bookmarks bar. Nowadays I use TamperMonkey to bind
window.addEventListener("load", ()=>{
window.addEventListener("keydown", e=>{
if (e.ctrlKey && e.altKey && e.keyCode == 83)
[...document.querySelectorAll("body *")]
.filter(elem => getComputedStyle(elem).position.match(/fixed|sticky/))
.forEach(elem => elem.parentNode.removeChild(elem));
});
});
and it became second nature to tap
This is my Disagree button. This is how to not consent to cookies. Think of the network load you’re saving, and the phone book cookie database servers you’re liberating, and that precious “site quality” you’re optimizing. Save the web, folks.
sidenote: The only reason I don’t have this run by default is because it sometimes hides useful things. Like site navigation bars, or various floaty hamburger menus. Some sites use sticky elements to great effect. (example)
Now if you were really cool, you could extend
I’m writing this as part of #100DaysToOffload. You can directly check out other participating blogs or take part yourself.
How to not consent to cookies (permalink) (tweet)Why even own a Raspberry Pi?