Skip to content
Fragmented Development

Javascript for Layout

I browse with an Firefox extension called NoScript, because it's one of the only ways to secure yourself against most of the nasty things that lurk on the internet. Right now, it's almost a silver bullet for web security: it is rather hard to automatically compromise someone's PC without javascript. If you're at all concerned about identity theft or keeping your computer clean, then this extension is for you.

Lately, I've seen a rash of pages that react very strangely in my browser, simply because I have Javascript disabled. Half the styles will dissappear or not be applied at all, the layout will be severely altered, links and navigation are completely broken, etc.

Take FedEx.com for example. With Javascript enabled, you get a reasonably standard web site layout. The navigation, which uses simple drop-down menus, is positioned at the top.

A side-by-side comparison of the fedex web site, with and without javascript enabled

However, when you disable javascript, the menus end up reverting to their obvious unordered list heritage, and overlap themselves quite a bit. Still "useable", but it also pushes the rest of the site off of the first page. You have to scroll down before you can see the rest.

If these items required javascript, then that would be one thing. I can quite understand when an application like Google Maps doesn't work without Javascript or Flash. If possible, I think it's reasonable to degrade gracefully, but that's a topic for another time. Simple drop-down menus do not require javascript and shouldn't use them. It complicates the code behind the page, and slows down the functionality for the client - Javascript is several orders of magnitude slower than CSS.

Xanga is also guilty of this abuse of Javascript. The login box on their main page, a simple HTML form, now requires javascript to submit. A simple HTML submit button can serve the same purpose, yet they feel my browser should have to interpret their client-side scripts every time I log in. I cannot express how irritating this is, and it may cause me to stop using their service.

Please, folks, let's code responsibly. Don't require Javascript to use your page unless it's absolutely necessary. Due to it's malicious possibilities, more and more people will be turning it off in the future. Build your sites so that Javascript isn't a required component, and everyone wins.

Tags: javascript


Comments

<p>Google maps actually works without javascript too :)</p>

Dennis


Add Your Comment