Ask HN: Why would you disable JavaScript?
Base info: I'm a front end dev born in the early 90's with three years experience.
A lot of older dev's that I've worked with have told me that best practice often includes making sure that the site is usable even if you've got javascript disabled.
To me, this is completely bonkers. Are we really supposed to cater to the sub 2% that chooses not to use javascript?
To me it would make more sense to use that time to make the sites usable for visitors with disabilities by including screen reader support and stuff like that.
90 comments
[ 2.5 ms ] story [ 156 ms ] threadI would imagine the amount of people disabling JS would be a lot more coming from a site like HN, compared to say, pintrest. It would be worth making sure your site functions without JS if you know a lot of your audience will be disabling JS.
Most of the time browser security flaws rely on JavaScript in some way, so this makes me more secure by default at the expense of usability. It has a happy side-effect of disabling other random annoying things as well.
A website needs to work perfectly (if even simplistic) and make sense with all styling and dynamism disabled.
Make sure your documents makes sense when viewed in a browser like lynx. Then move on to enhance it with dynamic features (JS) and styling (CSS).
Also, it's not sub 2% today, it's more like sub 0.01%.
For particulary security sensitive areas, like banking web software, I'd very much appreciate it working with JS disabled, since I take particular care on security when visiting those (updated, secured, sandboxed OS within VM, not used for anything else).
http://en.wikipedia.org/wiki/Progressive_enhancement
http://jakearchibald.com/2013/progressive-enhancement-still-...
Only time ghostery breaks sites for me is when some massive 'page failed to load' element site on top of the content. I can delete those with dev tools.
For web applications where you don't care about content being indexed, I wouldn't worry about it being a javascript only application (and this is the direction lots of apps are heading with frameworks like Ember.js, Angular.js, and Meteor).
Although, I am sure someone proposed to make it deprecated in HTML5.
[0] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/no...
[1] http://www.w3.org/TR/html5/scripting-1.html#the-noscript-ele...
The only hardcore crowd who disables Javascript entirely are people who are paranoid about ads and the uber nerd (as seen here on HN).
As a web developer myself, I would never waste what busy time I have catering to this audience. It's the same argument for why, at a certain point, you have to make a clearcut decision about how far back into legacy browsers you care to support. Large parts of Asia are stuck on IE6 because they have pirated Windows XP, but most of us don't care and probably don't need to.
Because not all search engines could cope with it (this reason now obsolete).
Because of a variety of screen readers and browsers which don't (reason also obsolete).
It's good practice to not go with batshit insane navigation, however (infinite scroll interactions with the back button, anyone?), or require JS for trivial inanities, or not have relatively meaningful URIs.
Now I agree it's only to support web fundamentalists who disable it completely, and those people surely must be used to having sites not work properly.
At the same time, if you require JS for things that don't need it, like basic navigation or dropdown menus, then that's lame for a different set of reasons.
In general, the principle of progressive enhancement is still a useful and important one. It's good to know how to make a great website in pure html and css, and then to layer the JS on top, simply because it's an effective technique that results in good code and usable websites.
With that said, out of our 1m visitors a week, we have less than 0.1% with it disabled. So it's a tradeoff - how long will it take you to code the extra to allow those 0.1%, and does this require extra code and junk up.
We don't support any browsers once it gets to below 1% - aka IE7 so I don't generally go out of my way to make sure everything works for non-javascript users.
It used to be more important back in the day with the old school mobile browsers etc with the good ol' WAP (as Jonnie says)
In my opinion: No.
JavaScript should be treated as default feature of the browser now. It's about as worth the effort as catering to people who want to use Lynx as their browser.
The screen reader argument is bogus too, modern screen reader software is not hampered by JS.
I also wonder if those who disable JS because of the increased attack surface also disable CSS as well.
Via: http://stackoverflow.com/questions/718611/css-injection-what...
The interpretation and application of CSS directives is not Turing complete, but often enough to leak information from your browser.
Not true. It's definitely possible to escape the sandbox. Some examples:
https://github.com/rapid7/metasploit-framework/tree/master/m...
http://www.mozilla.org/security/announce/2013/mfsa2013-12.ht...
http://www.iss.net/security_center/reference/vuln/googlechro...
https://bugzilla.mozilla.org/show_bug.cgi?id=805121
https://www.usenix.org/legacy/event/woot08/tech/full_papers/...
In my opinion better designs would emerge from the influence of this design constraint, along with better tools and frameworks.
Granted, not many websites need WebGL, but the ones that do need JavaScript.
yes webGL is a nice feature, but is it required?
For example, a menu is required for navigation, however it doesn't need animations to work. Sadly there has been a trend for things that actively slowdown or hamper speedy navigation (the breaking of the back button, animated transitions etc.)
Thats not to say JS is inherently bad. but when a website sucks 90% cpu to essentially display text, there is something drastically wrong.
What I want is to read things and communicate with people.
It's very much a financial decision. Who is your target market and is it reasonable to assume they will have a modern browser OR you can dictate that they have a modern browser.
You then have the issue of accessibility.
> Surprisingly, the proportion of people that have explicitly disabled JavaScript or use a browser that doesn’t support JavaScript, only makes up a small slice of people that don’t run JavaScript.
https://gds.blog.gov.uk/2013/10/21/how-many-people-are-missi...