💾 Archived View for blog.schmidhuberj.de › 2021 › 12 › 16 › war-against-cookies-and-javascript captured on 2024-05-12 at 15:13:05. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-03-01)
-=-=-=-=-=-=-
Posted on 2021-12-16
A few months ago I decided to go to war against JavaScript and cookies, and I am not talking about Gemini. I have decided to block all cookies and JavaScript on most websites, and you may also want to.
Probably the most important question is why I decided to do this. The most used reason to do this is because of privacy-reasons, but this is not why I turned these technologies off.
Almost two months ago, I just wondered if I could use the web without cookies and JavaScript. Most websites make heavy use of these technologies, so I thought it might be a nice challenge. And that is why I did it, I just wanted to challenge myself to do this.
As I use Qutebrowser as my default browser, this is just as easy as adding
c.content.cookies.accept = 'never' c.content.javascript.enabled = False
to your configuration.
If you do this and you use some websites regularly, you might notice, that it might be better to leave some cookies on and enable JavaScript on some website. Digging deep into the Qutebrowser-documentation, I found the solution:
with (config.pattern("*://*.your.website/*")) as p: p.content.cookies.accept = 'no-3rdparty' with (config.pattern("*://*.other.website/*")) as p: p.content.javascript.enabled = True
You might notice the weird looking URLs with stars. These are called URL patterns and a small paragraph about these can be found in the Qutebrowser documentation.
After this problem was solved, everything worked fine. But if you know anything about programming, you would know that this is not good code if repeated several times, so I refactored it with my limited python-knowledge. I decided to put all my URL Patterns in separate files, one pattern for each line, and read this file and make the above mentioned changes:
path = Path(__file__).parent / "allow-cookies.txt" with path.open() as fp: while True: line = fp.readline() if not line: break with (config.pattern(line)) as p: p.content.cookies.accept = 'no-3rdparty'
And this is, what I currently use, and it works great.
It is going great so far, I currently only have six websites I allow cookies and 10 websites I allow JavaScript on (excluding localhost). These cover most of the websites I regularly visit and I trust. Of course there are some websites I do not trust and that will not work without cookies or JavaScript, that is why I sometimes resort to Firefox as a backup.
It depends. I would definitely advise everyone to disable cookies. Even though most websites use cookies, most do not even need them and pop up with the famous cookie-banners we all love to hate on. When blocking cookies, you can feel good clicking the highlighted "I accept all cookies"-button instead of turning off every lever on mentioned cookie-banners with subpages.
Turning off JavaScript is a different beast. Sadly many websites need JavaScript to display their content correctly. Turning off JavaScript will result in many "Please turn on JavaScript to view this website", where you either have to turn on JavaScript, use your backup-browser or go search for a different website with the same content. I would only recommend blocking it if you want to challenge yourself.
I will definitly keep on blocking both cookies and JavaScript, but I would like some finer control over what exact scripts will be blocked, similar to uMatrix in Firefox.