JavaScript
The usage of JS on this site #
I deeply respect the desire to avoid using JavaScript when browsing the web. I designed this site to gracefully fall back in functionality should JavaScript be disabled. These changes only concern minor enhancements that cannot be achieved with HTML and CSS alone.
The following features are currently achieved with JavaScript and are therefore unavailable when JavaScript is disabled:
- Saving darkmode / light mode settings: Storing user preferences between page changes requires setting a value in localStorage, which requires JavaScript. If JS is disabled, the site will therefore fall back to the user’s system preference. The following code is used for this:
| |
- Closing the navbar menu on click outside: While it is possible to
implement an overflow hamburger menu without JS, closing it by clicking anywhere
outside is impossible, to the best of my knowledge. Therefore, nothing happens
in this case, and the user must manually click the small
xbutton. When JavaScript is enabled, the following code is executed:
| |
Improving this further #
If you are aware of a way to get around these limitations that require JS for now, please let me know! Besides enabling a good reader experience without JS, I enjoy playing around with HTML and CSS to achieve such goals.