9 ms·
Show HN: Is JavaScript Enabled?
- mileycyrusXOXO 7y agoI 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.
- na85 7y agoA 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.
- enz 7y agoWhy not switch to another browser or implement a DNS-level blocking?
- mileycyrusXOXO 7y agoThanks 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 7y agoYou 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.
- SquareWheel 7y ago>Given the recent news that Chrome will soon prevent ad blocking I think you misinterpreted a headline. Chrome is not preventing ad blocking. Chrome is changing the content blocking APIs to match Safari's. Ad blockers will of course still exist. Also, red as a color for "yes, enabled" is completely contrary to user expectation.
- userbinator 7y agoI've seen plenty of "you have JS disabled, please enable it for a better experience" warnings[1], but I wonder how many have a "you have JS enabled, please disable it for a better experience" warning; obviously, I would not see them, but perhaps others here might've come across such before. [1] I once listened to one and turned JS on for a try, only to be bombarded with a bunch of ads, hover-overs, something that kept following the cursor, and other disturbing crap. That was definitely a lesson I won't repeat...
- Causality1 7y agoI 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.
- umanwizard 7y agoI think your downvoting has less to do with whether turning off JavaScript is a good or bad practice, and more to do with people just being sick of hearing about it. In every story that’s even tangentially related, someone always feels the need to bring up the fact that they can’t believe anyone would ever have JS turned on, even if it’s totally irrelevant (like it is here). It’s basically the Hacker News equivalent of people getting annoyed at vegans.
- thethirdone 7y agoI think commenting about the linked page being completely broken without js enabled is relevant (especially if the page could be just as good without it). I don't think it merits much conversation want time, but remembering accessibility is good. Similarly, accessibility features for the (color)blind should be mentioned if they are bothering someone.
- mkozlows 7y agoJavascript being enabled/disabled has nothing at all to do with accessibility. A site can be JS-heavy and fully accessible. (Most aren't. But it's because they're developing it poorly, not because they're using JS.)
- thethirdone 7y ago> Javascript being enabled/disabled has nothing at all to do with accessibility. It does have to do with how well people with js turned off can access sites.
- SquareWheel 7y ago
- deleted 7y ago[deleted]
- _ZeD_ 7y agoBut... Why don't you just use the <noscript> tag? https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript https://developer.mozilla.org/en-US/docs/Web/HTML/Element/no...
- userbinator 7y agoThat's what the site uses: <noscript>This text is in a <noscript> tag and should display if JS is disabled.</noscript>
- Thorrez 7y agoThe 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.
- mileycyrusXOXO 7y agoI initially made this site to test an extension, I wanted to test for two things: - Javascript does not run. - noscript tags are swapped with divs. Just because a noscript tag's content is visible, does not mean that javascript is disabled.
- czr 7y agoMinor, 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-setattribute-vs-attribute-in-javascript https://stackoverflow.com/questions/3919291/when-to-use-seta...
- mileycyrusXOXO 7y agoThanks, that is much cleaner. I'll spend some time tomorrow cleaning up the code.
- runarberg 7y agoI 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.
- mileycyrusXOXO 7y agoYou are correct, I am going to fix this. There is comment below where someone has a screenshot of how it looks in lynx, where CSS and JS don't exist. Instead of using CSS to swap visibility I am going to revert to how I initially had it where JS changes the text from 'disabled' to 'enabled'. Edit: Fixed it, thank you.
- runarberg 7y ago<nitpick> I would also recommend against using the `<h1>` tag to convey the main information. Usually `<h1>` is used for the main heading—which I presume is the text ”is js enabled” which is located at the top, but wrapped inside a `<nav>`instead of a `<header>` to denote the document structor and `<h1>` to denote the text’s purpose as a main heading. Instead I would use a `<strong>` tag to convey the main information, and a nested `<b>` (the Bring attention to element) to spell the word “enabled” or ”disabled” </nitpick>
- runarberg 7y agoThis 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 7y agoGood 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.
- z92 7y agoI 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.