Posts Tagged ‘javascript’

7 Rules of Unobtrusive JavaScript

// November 29th, 2007 // 1 Comment » // development, javascript

When we develop work using JavaScript, how many of us assume that the web demographic of our audience have JavaScript enabled? There are many developers out there who seem to think that just about everyone on the planet has JavaScript enabled and just go ahead and write fancy code that needs JavaScript enabled and to hell with users who have disabilities etc.

Not only is this very bad practice but, it can drive visitors (and business) away from your web site if they can’t see what they want to see – your content. So next time you think about adding that slick looking sliding menu, or image gallery, ask yourself some questions –
If JavaScript is disabled, will my visitors be able to have access to content? How will this affect accessibilty and usability? Can my visitors navigate the site without using a mouse?

In much the same way we treat our mark up and style sheets to ensure they meet and comply with web standards etc, JavaScript should get the same level of care and scrutiny to ensure that your code is logical and can be maintained and passed on to other developers with ease.

Christian Heilmann explained his 7 rules of unobtrusive JavaScript at a recent workshop he gave in Paris. It’s a startling read and something that should give us all food for thought.

Link: The 7 Rules of Unobtrusive JavaScript by Christian Heilmann