Breadcrumbs

How Not To Use JavaScript

The other day I was browsing around Hewlett Packard's website (external link) for a printer driver that would work with my Mac. I never did find the driver, but I don't blame them as the printer is ancient. While browsing I switched tabs for a moment to test the usability of a system I was working on that used "unobtrusive" JavaScript. I turned off Javascript in my browser. After messing around a bit with some coding to compensate for lack of JavaScript support, I switched back to my HP tab.

I instantly saw that the layout was destroyed. All of the coloring and structure was completely discombobulated. I turned on Javascript and saw that the layout again worked. This odd dependency on JavaScript puzzled me, because I've never heard of a designer using JavaScript to do that much in a layout.

Hewlett Packard's use of JavaScript is a fine example of how you shouldn't code. Relying on JavaScript that much for a design to properly function has its gigantic pitfalls. Internet Explorer lacks support for the modern uses of JavaScript (DOM) and many users turn off JavaScript, believing that everything malicious revolves around it.

JavaScript has lied dormant for a few years, when the "Wow, I can move things," coolness factor wore off. Once the wide spread rumor among non-web developers that JavaScript is what hackers use to harm your computer, JavaScript usage considerably dropped. It was too risky to depend a lot on JavaScript for your website.

Due to the lack of Internet Explorer 6's support for truly customizing your JavaScript experience, most users just turn it off. Opera and Firefox users are able to control their cookies and JS preferences quite easily. Recently, Javascript usage has increased as the development of DOM and DHTML take off.

2005 was marked the year of DOM (external link) by many web developers, as the progression of CSS is on hold until CSS3. JavaScript should be used in an "unobtrusive" method, allowing users without the support to still use your website. Hewlett Packard's scripting was completely unusable.

Remember when you're designing webpages, use JavaScript at a point where it only enhances your page. Have a good weekend and code properly!

Tags:

Comments

  • I took a look at it without javascript and boy does that look terrible. I agree with you. What were they thinking?

    Posted by stickycarrots (external link) on Sat 6 Aug 2005 at 0:37

  • wow thats bad. Never seen it done likw that before.

    Posted by Matt Oakes (external link) on Sat 6 Aug 2005 at 5:42

  • I remember that a lot of my older layouts had large dependencies on JavaScript, but I don't think that I ever went that far. On AvidGamers you really had to rely on JavaScript for almost every extended feature, so it was a given that your members would have it enabled.

    In HP's case their website could have been as dynamic as it is (the layout changes each time) if they used PHP. You could use ASP too, but that comes with a huge price.

    Posted by Ethan Poole (external link) on Sat 6 Aug 2005 at 6:27

  • Yeah, on AG I basically let AG write all of its stuff into arrays and then rewrote everything the way I wanted it using Javascript. wink

    What's the huge price of using ASP then?

    Posted by Frans (external link) on Mon 8 Aug 2005 at 7:43

  • its made by microsoft.. thats more than im willing to pay.

    Posted by Mark Lloyd (external link) on Mon 8 Aug 2005 at 16:06

  • Haha, I though a company like HP should know a little bit more about web design then that. Suckers razz

    ASP, I worked with it when I first came to Lowter. Which was quite a long time ago. Now I'm basically gonna throw away all that Microsoft shit away. I really don't like how Microsoft is control the market. razz

    Posted by Daniel Malmqvist (external link) on Mon 8 Aug 2005 at 16:34

  • ASP developers are usually paid more - because they have a Microsoft certification. Windows Server edition isn't too cheap either, and requires much more maintence than an Linux system running Apache. In the end ASP cost more for a company.

    Posted by Ethan Poole (external link) on Mon 8 Aug 2005 at 18:35

  • In the case of a company like HP I don't think that twice or perhaps thrice the cost is "a huge price". wink

    Posted by Frans (external link) on Tue 9 Aug 2005 at 8:34

  • True that Frenzie. I do think HP can afford alot more then they are paying for their website razz I mean c'mon it's a company that exists all over the world for gods sake wink

    Posted by Daniel Malmqvist (external link) on Tue 9 Aug 2005 at 9:52