45 lines
No EOL
1.9 KiB
Markdown
45 lines
No EOL
1.9 KiB
Markdown
---js
|
|
const title = "Please make websites work without JS (when possible)";
|
|
const date = "2025-04-13";
|
|
const draft = false;
|
|
const tags = ["technology", "web"];
|
|
---
|
|
|
|
_Or at least, use a `noscript` tag._
|
|
|
|
On the Internet, we have a technology to make pages interactive called
|
|
JavaScript. Sounds all good, right? It's not. JavaScript can reduce user
|
|
privacy, slow down page loading, waste bandwidth, along with a ton of other
|
|
things.
|
|
|
|
## Reducing privacy
|
|
|
|
Most, if not all, methods of tracking users on the internet are JavaScript
|
|
based. This includes things like reCAPTCHA and Turnstile too. Those are
|
|
often ineffective at keeping out bots while old text and audio based CAPTCHAs
|
|
work fine for almost all cases.
|
|
|
|
## Slows down page loading
|
|
|
|
Usually, the majority of the time it takes to load a modern webpage is the
|
|
JavaScript frameworks. Many things often done in JavaScript can be done
|
|
with plain old XHTML. You can also do basic dynamic content with server-side
|
|
rendering, for example the author's [personal site](https://nyx.everypizza.im),
|
|
made in Flask. It doesn't have JavaScript, yet the visitor count and now playing
|
|
status can change. So instead of the browser loading a ton of JavaScript, it
|
|
loads just the HTML, CSS, and fonts.
|
|
|
|
## Wastes bandwidth
|
|
|
|
Bandwidth is one of the largest problem. Going to a website like the homepage of
|
|
Google that works just fine without JavaScrpt loads a whole 2.5MB of JavaScript.
|
|
Now, caching improves this a lot for those on metered connections, however that
|
|
doesn't make it perfect.
|
|
|
|
## Alternatives
|
|
|
|
First, ask if the content actually needs to be dynamic. That's the first step.
|
|
Next, ask if it needs to be updated in real time and then that data needs to
|
|
be shown to the user. If yes, then JS is the only option. Make sure to include
|
|
a `<noscript>` tag to tell the user that JavaScript is needed, explaning why if
|
|
needed. However, if no, consider using server-side rendering as mentioned before. |