HI version is available. Content is displayed in original English for accuracy.
Advertisement
Advertisement
⚡ Community Insights
Discussion Sentiment
42% Positive
Analyzed from 908 words in the discussion.
Trending Topics
#noscript#page#javascript#script#fine#scripts#reason#content#load#instead

Discussion (16 Comments)Read Original on HackerNews
The WHATWG recommendation:
is fine as it is, but changing the page after scripts load can potentially mean seeing the no-script content briefly (FOUC - Flash of Unscripted Content). Putting the message in a <noscript> tag avoids that.These days you can use CSS to only show the message after a short delay.
But the majority of websites have no business actually requiring JS so the W3C recommendation is the only one that matters.
Either way, make sure you have something sensible to display for all scenarios, even if it's just an error page. Mysterious blank pages are not fun.
Any no-JS extension worths its salt should actually at least provide an option to ignore <noscript> as some websites that would otherwise work perfectly fine without JS use it maliciously.
The most infuriating one is when the javascript deletes the entire page content to show an error message due to some exception. Doubly so when the failing functionality is only used for tracking or some other unwanted "feature".
> “One of the few traps of the web”
…for some large value of “few”
The author answered their own question. In even the best effort case, noscript is the fallback.
I'm not even sure what they expect the website maintainer to do for most of that list. If they knew themselves, they would have put it in the blog post. Is this instead a call to draft new w3c specs or revisions? What am I misunderstanding? For a site that has "hacktivism" in the domain name, whining like this is a bad look.
> For this reason, it's generally better to avoid using noscript, and to instead design the script to change the page from being a scriptless page to a scripted page on the fly
That seems perfectly reasonable for modern sites and browsers to be able to do. `noscript` is effectively a relic from older days where you just didn't have the same budgets, tools, and browsers as today, where you couldn't seamlessly enhance the site how you can now. We shouldn't continue to use it in the same way we shouldn't continue to use `marquee` or `blink`.
But writing a page that works by itself and modifying it by scripts will work almost everywhere as long as you add any external dependency in a way that invalidates your script on errors.
The noscript tag is just a way to conditionally display some HTML. There's no reason to avoid using it unless you are deeply entrenched in a pseudoreligious fight against javascript.
It really is just whining.
> didn't have the same budgets, tools, and browsers as today, where you couldn't seamlessly enhance the site how you can now
I'm sorry, but... what?
I don't know if you were coding back in those days, but I definitely remember how much more work it was to do progressive enhancement back then if you wanted a really JS-enhanced site. We were all basically individually inventing it, because it hadn't be standardized and popularized yet.
I honestly don't understand the framing of best practices here as "whining." I also don't understand your refusal to read the article, because you say "no reason" but the article explicitly states the reason:
> The noscript element is a blunt instrument. Sometimes, scripts might be enabled, but for some reason the page's script might fail.
I dunno, I like having my page continue to reasonably work when unforeseen errors happen. (And they do happen. We've been at this business for decades, but errors have happened, can happen, and will continue to happen.) I generally prefer my users to have a good experience when possible. And if I can design my page intelligently, to progressively enhance, instead of displaying a blunt "WHAT ARE YOU, A JAVASCRIPT-HATER LOL" error message, well, I'd prefer that. =)