Much Ado About NoScript


Y U No Enable JavaScript

Is that guy still relevant? I don't know. For all I know some orange politician changed him to mean something totally different*. Either way, JavaScript is still relevant, although some people don't think so.

Y U No Enable JavaScript?

It's true that you can have a website sans-JavaScript, but that extra added functionality is what separates a website from a book. Sure JavaScript got a bad rap back in the DHTML days with their "Hello FamiliarNameMissing" error messages, and yes, the insistent pop-ups that won't go away caused some problems, but we're passed that now. JavaScript is part of the web experience. It makes things likeable on Facebook, it makes things tweetable on Twitter and it makes websites like this one shareable (ahem).

But in all seriousness, some people don't support JavaScript. They actively chose to turn it off. This could be because they feel it's intrusive or because it's tracking things about them or because it slows down websites. Around 1% of all users have JavaScript disabled. If you're building a gallery, a slider, an interactive piece or something fun for your user, you'll need JavaScript. If you are using Angular.js to bring in content, you'll need JavaScript. If they don't have JavaScript enabled, they won't be able to use your site.

How to Check For Stupid

Since we can't use JavaScript to check if JavaScript is enabled, we'll have to use something else. Luckily, HTML has an element that does just that.

Proper developers will tell you that websites should work without JavaScript. Content should be accessible without it and Google even penalizes content creators who have content generated by JavaScript. However, sometimes it just has to be brought in that way (eg: constant loading content like Twitter, or live chat interaction like Facebook, etc). If JavaScript needs to be used, I often style the <noscript> to take up the entire screen and block out any interaction the user can have with the website.

Some people say that's bad programming, but if you're dealing with 1% of users who refuse to turn on JavaScript in the age of Web 2.0, you can be a little nasty.

One thing worth remembering is that older IE browsers won't accept styles on a <noscript> tag. Instead, you have to put another element inside it, and style that, like so:

If you'd rather redirect the user away because they don't have it enabled, you can use a <meta> tag too.

Which is almost as evil as blocking out the website all together too!

 

*if they did, I apologize to whatever group I offended. I did it for the lols.

Sign-up for inside tips for making
your website more beautiful!

* indicates required

Close

Sign-up for inside tips for making
your website more beautiful!

* indicates required

Close