
Show HN: Is JavaScript Enabled? - mileycyrusXOXO
https://isjsenabled.com/
======
mileycyrusXOXO
I made an extension and needed to be able to quickly validate whether js was
enabled. Surprisingly, there weren't any stupid simple websites to do that so
I set out to make one. A few hours later
[https://isjsenabled.com/](https://isjsenabled.com/) was online.

I had a lot of fun carefully picking the colors, coding the site from scratch
and stopping all work to solve a very tiny problem. It reminded me, there's
nothing better than the feeling of having made something, no matter how small
it is.

Thought it would be fun to share.

------
czr
Minor, but instead of:

    
    
        status.setAttribute('style', 'display:none');
    

I would suggest just writing:

    
    
        status.style.display = "none";
    

(and similarly for the other DOM modifications; see [0] for a discussion of
setAttribute vs property syntax)

[0] [https://stackoverflow.com/questions/3919291/when-to-use-
seta...](https://stackoverflow.com/questions/3919291/when-to-use-setattribute-
vs-attribute-in-javascript)

~~~
runarberg
I would recommend against using CSS to hide this information at all since a
user might have both CSS _and_ JavaScript disabled. In fact I would have used
JS to manipulate all elements conveying the relevant information.

~~~
SquareWheel
If a user turns off CSS then virtually no websites will render correctly for
them. Adding a specific detection for that fail state is really just
unnecessary bloat.

~~~
dvfjsdhgfv
You're kidding, right? Turning off CSS is used together with turning of CSS
and images to _improve_ the legibility of some websites.

For example, using Medium with everything on is a pain. But if you switch off
JS, CSS and images, very often the whole text of an article fills in one
screen, is quite clean and really fast. Using Medium in this way actually
becomes a pleasure (unless the images are a apart of the article) - you can
navigate the website rarely using the mouse. In any case, I'm not alone in
using the web in this way - turning everything on is just a waste of time and
resources. You can check it easily yourself with an extension like disable-
HTML that allows turning off these thing instantly.

~~~
SquareWheel
Here is how Medium looks without CSS:

[https://i.imgur.com/MAalREE.png](https://i.imgur.com/MAalREE.png)

If you find that more legible then all power to you, but nobody browses like
that.

~~~
flukus
That appears to be the index page rather than the article and is not too bad.
But that's just the default browser layout, sites usually look a lot better in
reader mode.

Also, with js disabled your link is just an empty page, imgur is too
incompetent to be able to show images without JS.

~~~
SquareWheel
Reader modes are usually clever enough to grab content from <article> tags, so
it doesn't actually have to render the whole page. Plus they insert their own
CSS, of course.

------
runarberg
This is what I get when viewed in Lynx which certainly has JS disabled.

    
    
            Picture of a browser window.
    
        Javascript is disabled in your browser.
    
        Javascript is enabled in your browser.
    
           This text is in a <noscript> tag and should display if JS is disabled.
    
    

[https://imgur.com/a/RihgnoD](https://imgur.com/a/RihgnoD)

~~~
mileycyrusXOXO
Good catch,

Initially this wasn't a problem because the script changed the text from
'disabled' to 'enabled'. Now the script sets 'display:none' and
'display:block' to control which element is visible. You bring up a good case
to go back to the previous way.

Edit: Fixed it, thank you.

------
_ZeD_
But... Why don't you just use the <noscript> tag?

[https://developer.mozilla.org/en-
US/docs/Web/HTML/Element/no...](https://developer.mozilla.org/en-
US/docs/Web/HTML/Element/noscript)

~~~
userbinator
That's what the site uses:

    
    
        <noscript>This text is in a &lt;noscript&gt; tag and should display if JS is disabled.</noscript>

~~~
Thorrez
The site uses 2 methods: <noscript>, and javascript to hide an element and
display a different one. This way you can tell if the methods disagree.

------
z92
I browse JS disabled. And if some page doesn't render and really want to read
it, toggle it on with a single click using a browser plugin for that site
only.

------
Causality1
I always get downvoted for saying I run NoScript with a whitelist but 90% of
my browsing time is on sites I've been to before and I don't think any other
single security measure reduces your attack surface as much as turning JS off
does.

~~~
SquareWheel
That's totally fine, and part of what makes the web great is that you're able
to tweak things on the client like that.

Really it only becomes a problem if you become one of those people that
harasses web devs for not supporting noscript users. At the end of the day
Javascript is a web standard, and it's developer's jobs to target those
standards.

~~~
userbinator
No, it should be the developer's job to make content accessible in the most
efficient way and to the widest audience. JS can be, but often it really
_shouldn 't_ be used and there is a simpler solution. Some sites really do
need to be JS webapps, but most of them don't. Your users may not care whether
you use JS or not, but they do care when your site is slow because you chose
to "appify" it unnecessarily and make it require downloading and running JS to
show the same content that could've been directly served as a static HTML
page.

~~~
todd3834
I would argue that the developer’s job should be to determine whether or not
supporting users without JavaScript would generate more money than it costs to
maintain. It’s going to depend on the target audience and what you are
developing. For example: Google Docs with JavaScript turned off makes no sense
to me. Hacker News on the other hand could make sense. Much higher percentage
of security concerned users and the amount of work to support it is likely not
monumental.

------
na85
A suggestion:

Given the recent news that Chrome will soon prevent ad blocking and given ads
can run untrusted JavaScript, the only sane choice is to disable JavaScript in
the browser.

I suggest that you change the "enabled" colour to red, to highlight the user's
risky behavior.

~~~
mileycyrusXOXO
Thanks for the feedback, I've been debating this. In my earliest version I had
the colors as you suggested but later decided that most users would expect it
the other way. I'm open to changing it, but I'll need to think about it.

~~~
ronilan
You made the right choice.

“Is javascript enabled?” is a true/false question. Just like with a traffic
light which answers the question “may I proceed?”, green commonly stands for
true and red for false.

If you make isjavascriptdisabled.com than colors should be switched.

