freeshell.de/~shvehlav

~/

luakit and ,ts

2021-10-09

'I like the internet' is a phrase I'd like to use more often, but the powers that be forbid me from heartily embracing said statement. In this instance I will refrain from the spiritual issues some may attribute to the digital web of text files and will instead embrace the technical side of things.

Disclaimer: I have nothing personal against javascript, in fact I might even feel bad for its abuse.

luakit steroids

In this article we're going to be using luakit and a simple method to disable javascript. You probably already know, why you seek this functionality, though I believe you aim to use it to test your latest website project to make sure it can serve its content to those, who can't use javascript.

To tell you that you could get around all those "ALLOW COOKIES OR CRY" popups on a majority of websites that you only need to read from, would probably be immoral.

Of course if a website becomes disfunctional (for our purposes meaning "we can't access the content we came for"), after you pull this card out of your sleeve, that's its business. We all understand that's how it makes money, learns about our favorite meals, offers us relevant content, watches us urinate, etc. What's actually disgusting is that it prevents plain text browsing and treads on the very basal feature of the internet - serving text.

In the famous words of Emma Goldman: "Plain text or bust!"

luakit's config file:

Copy the default file to your home folder of configurations.

$ cp /etc/xdg/luakit/rc.lua ~/.config/luakit/

Next, open the newly copied file in your favorite editor and ucomment (remove --) the following line:

--require "noscript"

In simple terms, as the config file itself will tell you, pressing ',ts' in a sequence will disable javascript for the current domain. Note that you have to refresh the page manually for it to take effect. Pressing it again will re-enable scripts back.

In more great news, your choices are saved locally, thus luakit will remember which sites to block scripts on, every time you visit them. You can press ,tr to reset these rules.

The purist variant

You can achieve the opposite functionality by appending the following somewhere in the user scripts section of rc.lua. Preferably after the previously uncommented line. This will disable javascript everywhere, leaving you to toggle it with ',ts' should you need it.

require "noscript"
local noscript = require "noscript"
noscript.enable_scripts = false

This article is sponsored by disgust. No, not the sugar company. The emotion.

Further reading

luakit(1)

https://github.com/luakit/luakit/issues/937