Do you have javascript disabled?

By crisp on Thursday 28 October 2010 01:55 - Comments (18)
Categories: Internet, Javascript, Tweakers.net, Views: 20.367

Every time you create a new hot DHTML AJAX Web2.0 HTML5 feature that at least involves a certain amount of javascript the same question arises: how do you build this feature with accessibility in mind? Is it a very important feature and should you cater to the lowest denominator and build using progressive enhancement, or can you use graceful degradation and/or supply a lower-level alternative, or is it just a gimmick and is it ok to ignore part of your audience?

It's that last question that's bothering me; from an idealistic perspective I would say that it is never ok to exclude anyone, but from a more pragmatic perspective I would answer that question with another question: how big a part are we talking about? Only with the answer to that question can you make a sound decision.

When it involves scripting this question mainly boils down to: how many of my visitors have javascript disabled? Support for various new technologies can then be deducted from that number using knowledge of browser share. Now browser share statistics aren't hard to find; we even keep our own, but statistics on how many users have javascript disabled (in some form) are hard to find these days - maybe I didn't look hard enough, or maybe it is because most statistics nowadays are gathered using javascript itself.

Having been asked this very question I set out to investigate. My preliminary guestimate, based on older stats such as on w3schools (which also has a tech-savy audience like Tweakers.net) was that it would be between 5-6% of our visitors which would have javascript disabled or using a non-js capable agent. It now seems I was very wrong about that...

But before I present you the details of my own investigation, let me ask you the question:

Do you have javascript disabled?Results:
http://poll.dezeserver.nl/results.cgi?pid=364132&layout=1&sort=prc

Let's see if the outcome of this poll matches my result:

First of all let me explain my test methology which did not involve using <noscript> (I will test that approach later to see if it returns different results). What I did was setting a temporary cookie using javascript and then requesting a tracking script using a normal HTML <img> tag:

HTML:
1
2
<script>if(window.setJsCookie)setJsCookie();</script>
<div style="position:absolute;top:-1px"><img src="trackingpixel.php"></div>


Now the function setJsCookie was defined in one of our external js-files:

JavaScript:
1
2
3
4
function setJsCookie()
{
    document.cookie = 'js-enabled=1; path=/' + '; domain=.' + document.domain;
}


document.domain is always explicitly set to 'tweakers.net' to allow cross-subdomain cookies and trackingpixel.php (not the real name) is a script that validates the user's session (based on a session cookie - excluding bots) and writes an entry to the database incrementing either a 'js'-field or a 'nojs'-field based upon the presence of the 'js-enabled'-cookie. I used the session id as a primary field and also logged the user-agent string and whether it was a logged-in user or not. This was done randomly for 1 in every 100 pageviews during the timeframe of 10:30 to 20:30 (so 10 hours in total).

My first question would be: is this a sound and safe approach? The results only showed a very small fraction that reported both 'js' and 'nojs' on the same session id, so I disregarded those from the results. Still, the results were stunning:

When based on unique session id's I got 2.004 sessions reporting no javascript support on a total of 14.972 logged sessions; that's 14.8%! Now if I count total pageviews this number goes down; total 17.042 views with 2.070 reporting no javascript support; still 12%.

Then I looked at that ratio between anonymous users and logged-in users; 13.9% of anonymous users seemed to have no javascript support against 9.8% of logged-in users. And then the kicker; when I selected only Firefox-based user agents the percentage of non-js clients went up to 27.9%!

For other browsers these percentages were much, much lower, so Firefox seems to be the main culprit, and it is also the most used browser by visitors on our website. Would it be true that the NoScript add-on is that popular among Firefox-users? (maybe Mozilla itself suggesting it has some effect?). Of course NoScript also blocks most advertisements since most of them are javascript-based these days, making it an effective ad-blocking tool as well. And apparently we are doing too well in providing graceful degradation...

When it comes to ad-blocking; I already concluded, based on some earlier performance testing of banners themselves, that around 15% of our users were actively blocking bannerscripts (but not javascript in general since the measurements were done using javascript). When I add the 14.8% that are actually blocking javascript wholesome on our site, and adding an unknown percentage of users that do load banners but have means to make them invisible on the page, it would mean that 1 in every 3 visitors does not generate us any revenue. Now that's also something to take into account when thinking about providing non-js alternatives for new features; it's probably mainly convenient for the leechers...

Update 28/10 11:25
I have been logging an hour now using an alternative approach (document.write followed by a <noscript> section) and now I'm totally confused; this method only reports around 0.4% of users that have javascript disabled :?

Volgende: Internet Explorer 9 is the best HTML5 browser! 11-'10 Internet Explorer 9 is the best HTML5 browser!
Volgende: IE9 Pinned Sites; a lot of cruft in your <head> 09-'10 IE9 Pinned Sites; a lot of cruft in your <head>

Comments


By Tweakers user derx666, Thursday 28 October 2010 07:57

I use noscript mainly for the big annoying flashtype ads and for ofcourse scripts you generally don't want to run on your machine. Ads are getting more annoying, and use quite some system recources today. When you use your browser the way I do (I generally have more than 40 tabs open at the same time) this amounts to more than 30% cpu usage and amounts of memory Photoshop would be proud of. I have by no means a low end machine (c2d 2.2ghz 4gb ram on a laptop which is almost 3 years old), but 30% cpu usage is quite heavy...
So I use noscript. I block the domains which the big ad's come from, and allow the domain of the site I'm on. Which means I get some ad's, but seldom annoying, and if they're annoying I generally leave the site.

By Tweakers user Zyppora, Thursday 28 October 2010 08:28

The problem in the above described method is that there's two dependencies, instead of one. You're not just checking if JS is enabled, you're also dependent on the agent accepting cookies. I don't use NoScript and have JS enabled by default, because I use Adblock Plus to selectively get rid of those annoying advertisements and other scripts (we all know the intellitxt scripts that skyrocket your browser's resources and your pages' loading times just to get those buzzwords to become clickable). I have cookies disabled however, and keep a whitelist of which websites are allowed to set cookies. This could be a reason why your percentage of FF users is relatively high on the 'nojs' statistic.

By Tweakers user CodeCaster, Thursday 28 October 2010 09:04

how do you built this feature
Build ;)

How do those Javascript-refusers visit ASP.NET pages for which the developer hasn't avoided AutoPostBacks et cetera?

[Comment edited on Thursday 28 October 2010 09:08]


By Tweakers user Luuk1983, Thursday 28 October 2010 09:06

@Zyppora:

Agreed. My experience with statistics from various sites indicate that usually at least 98% of users have javascript enabled. Those other two percent are usually browsers or clients that don't have javascript capabilities. There are so many sites depending on javascript that disabling javascript would seriously limit the browsing experience.

By Tweakers user YopY, Thursday 28 October 2010 09:25

I'm pretty sure these figures would only apply to the userbase of this particular site, seeing that it attracts the more tech-savvy audience - and probably the more paranoid, too, as in 'omg noes big bad advertising networks harvest my private information, I must disable javascript!11'.

For the record, I don't disable JS, because it reduces my experience of most websites... and probably because I work with a set of websites that depends on JS to function properly (as in, it uses JS to submit forms to do things like order a product. Rancid.)

By Tweakers user 108886, Thursday 28 October 2010 09:35

I noticed something nice recently. In adblock i added the filter *metriweb* because noscript showed "allow metriweb?" all the time.

It appears to be a data-mining service, tracing your every move on Belgian sites...

After i blocked it, even though i almost exclusively visit english/american sites; the metriweb filter has slightly less hits than */ads* or *pagead2*
It's in my top-three right now with 14.311 blocks/hits (!)

I don't know what éxactly that metriweb does, but noscript and adblock sure make the the web a little more private and safe

By Tweakers user prutsger, Thursday 28 October 2010 09:50

About the web experience some commenters talk about... I have JS disabled by default and do not accept cookies, and use adblock to block ads. If I experience problems on a site, I decide if the site deserves it to get on one of the whitelists. That is a one time action per site, and overall it improves my browsing experience because I do not see those annoying ads and most sites load faster.

By Tweakers user ZpAz, Thursday 28 October 2010 09:59

I think that more 'techy' people block JS than 'normal people' to be honest, so for other websites these stats could be 'bigtime' off.

My thoughts on this subject are, it should be accessible by crawlers and such. But why would you disable javascript, thats like disabling CSS these days, javascript is now a big part of the 'web experience'.

Back in the old days javascript was sometimes kind of annoying with rmb blockers, a shitload of alerts and such, but those days are long gone and JS is usually used to create a better browsing experience.

By tech-no-logical, Thursday 28 October 2010 10:10

i am a 'javascript refuser' as codecaster so politely put it, and those default postback things are indeed teh horror. how do i handle them ? well, i usually don't, i simply go elsewhere. that doesn't always work of course. when absolutely needed, i grab another browser, grumbling in annoyance at the developer who built that pos.

why do i do it ? simply put : javascript is too often used for tracking purposes, which i avoid like the plague. i take a very defensive stand, which means i whitelist sites (with noscript usually) sparingly, and have the rest blocked. and while i'm at it, i'm probably one of the last people to surf without referrers, for the same reason (which actually gives me almost no problems at all).

all this has a positive side though : i'm a developer myself, and always make sure my stuff works with and without javascript. more devs should, imho. but maybe that's just my age talking ;)

btw : my tweakers-login obviously doesn't work here. probably something to do with javascript ;)

By Tweakers user Mike-RaWare, Thursday 28 October 2010 10:11

@ZpAz: Well, the last time I checked CSS wasn't executable code responsible for almost all security issues in web browsers.

By Tweakers user crisp, Thursday 28 October 2010 10:15

Zyppora wrote on Thursday 28 October 2010 @ 08:28:
[...]
The problem in the above described method is that there's two dependencies, instead of one. You're not just checking if JS is enabled, you're also dependent on the agent accepting cookies.
True, however for logged-in users (who obviously allow cookies) the figure is still almost 10%, and those users will also be more likely to whitelist our own javascripts.

As said I will rerun this test using a different approach to see if I get matching results :)

[Comment edited on Thursday 28 October 2010 10:16]


By Tweakers user crisp, Thursday 28 October 2010 10:18

Mike-RaWare wrote on Thursday 28 October 2010 @ 10:11:
@ZpAz: Well, the last time I checked CSS wasn't executable code responsible for almost all security issues in web browsers.
Javascript isn't either, although it is the intermediary used to exploit security bugs in plugins such as Flash and Java...

By Tweakers user Battle Bunny, Thursday 28 October 2010 11:29

Ik heb helaas op Tweakers.net ook weer adblock plus aan (stond in de whitelist), maar als je van die flitense flash banners krijgt waardoor je een artiekel niet meer kunt leze nga je imho te ver als site.

By Olivier, Thursday 28 October 2010 11:50

I never disable javascript, but I block every ads with Squid.

By Tweakers user Bosmonster, Thursday 28 October 2010 12:09

Battle Bunny wrote on Thursday 28 October 2010 @ 11:29:
Ik heb helaas op Tweakers.net ook weer adblock plus aan (stond in de whitelist), maar als je van die flitense flash banners krijgt waardoor je een artiekel niet meer kunt leze nga je imho te ver als site.
Je kunt als je de site veel gebruikt natuurlijk ook een abootje nemen. ;)

Ik verbaas me overigens wel over de hoeveelheid mensen zonder javascript. Vandaag de dag, met zoveel javascript op internet, ben je dan volgens mij wel heel erg beperkt in je browse-ervaring. Waarom zou je dat doen?

[Comment edited on Thursday 28 October 2010 12:10]


By Tweakers user Battle Bunny, Thursday 28 October 2010 14:25

Ik heb ook als 1 van de eerste een abbo gekocht destijds, alleen vergeten te verlengen ;)

Volgens mij zijn er veel mensen die er puur ads mee blocken maar zijn er ook verdacht veel mensen welke het uit hebben voor privacy gedoe enzo.

[Edit] ik ken een aantal mensen die niets van computers en Windows afweten, maar wél Firefox hebben ingesteld om aan het einde van de sessie de cache enzo op te ruimen. Als dat soort mensen iets lezen over een browser lek en NoScript enzo, zullen het waarschijnlijk ook installeren).

[Comment edited on Thursday 28 October 2010 14:26]


By Tweakers user Roytoch, Thursday 28 October 2010 15:49

Tsja, zonder javascript browsen is een beetje zinloos nu. Ik ga ook echt geen moeite steken in het werkend maken van niet-commerciele websites voor mensen die geen js aan hebben staan, beetje hetzelfde als dat ie6 ook lekker op kan zouten (zonder die eeuwige discussie weer te willen reanimeren).

By Tweakers user Kees, Sunday 31 October 2010 19:42

roy.ahuis wrote on Thursday 28 October 2010 @ 15:49:
Tsja, zonder javascript browsen is een beetje zinloos nu. Ik ga ook echt geen moeite steken in het werkend maken van niet-commerciele websites voor mensen die geen js aan hebben staan.
Het is ook een kwestie van accessibility van je site. Stel je meekt een site die bomvol staat met informatie voor de slechtziende en blinde mensen in ons land, en je doet dat door intensief gebruik te maken van javascript.. dan heb je je doelgroep nog niet helemaal door.

Maar dat zal inderdaad wel niet de belangrijkste doelgroep zijn voor de meeste sites.

Comments are closed