Tuesday, December 29, 2009

JavaScript – Not Required

As an end-user of many different sites, it appears to me that it is becoming increasingly difficult to have JavaScript turned off and increasingly dangerous to have it on. I’m a huge fan of JavaScript, but I think it’s unfair to design my web sites to force my end-users to have JavaScript turned on. So I try and make everything accessible without JavaScript. It might not look as fancy, but everything on my sites function and that’s what’s important.

Take my latest project, my wife’s re-design (not yet published as of this post), we’ve added several JavaScript niceties. However, EVERYTHING still works with JavaScript disabled and we pop-up nice little messages to let the end-user know why something is appearing the way it is. Here’s what we’ve done:

  • We have a group of images that fade in and out using jQuery on the homepage. When JS is disabled, the first picture is displayed and that’s it.
  • We have a Join Mailing List feature that uses ajax via the jquery.form plugin by Mike Alsup, which converts our form into an ajax form otherwise it leaves the default action. When JS is disabled, the call is the same, but our messages are formatted so the end-user will see a specific error or message stating why it’s formatted a certain way. To read more on how we implemented this, see the “jQuery AJAX with ASP.NET MVC” post.
  • For her portfolio page, we used jquery.lightbox, which pops up a nice modal effect for her images. When JS is disabled, every link just links to the picture and the picture pops up in the browser and then the end-user has to click back to get back to the gallery.
  • On her contact page, we use jQuery to decode her email adddress. To get around this issue, we use a real address for the mailto:, but it’s meant for spammers and we display a nice message letting the end-user know why they’re seeing email [[at]] domain [[.]] com. To see more on how we did this, see the “Trick Bots from Stealing Email Address with jQuery...” post.

Bottom line, don’t force users to do something they shouldn’t HAVE to do and make your web site accessible and friendly. Provide <noscript> messages when necessary and try disabling JavaScript on your browser and browsing your web site to see how people feel.

That’s it! As always, please comment if you see anywhere that I could improve or you just have a comment. Thanks for reading!

kick it on DotNetKicks.com

blog comments powered by Disqus
Related Posts Plugin for WordPress, Blogger...