I was looking to avoid the use of JavaScript in the web site. I have heard that using JavaScript can cause problems with some browsers!
Yes, it can.
I guess you are promoting the use of JavaScript!?!
Oh hell no! : ) Heh, I’m kinda known around here as the anti-JS nazi, though really my only problem with it is when devs use it as a crutch for their poor HTML/CSS skills : )
I thought using a Pure CSS navigation bar would be the answer to any potential problems with JavaScript! Do you disagree with my prior reasoning?
Nope, a “pure CSS” nav bar is preferred (though be aware, there are usability issues with dropdowns for some folks either way).
As Ralph said, IE6 can’t properly use one… however, they are not necessarily the ONLY folks having similar trouble with a CSS nav bar! (what do people using a touch device do, if they have no :hover??)
The way around this issue is to have your main-level menu items be clickable to somewhere that has all the sub-menu links in plain view somewhere. Because most users will be desktop users with a mouse, CSS and JS on, they won’t notice a redundant page. Users without mice, or using touch devices, or IE6 without Javascript will still have a way to reach your submenu links.
I actually use a bit of Javascript in my dropdowns nowadays:
I sometimes add a slight onmouseoff delay so that users with shaky hands don’t get deep into a menu and then lose it all because the mouse wandered off the submenu for a nano-second (though the deeper the menu, the less usable it becomes and the more usability/accessibility problems you run into, because they are delicate things).
I also add in some Javascript to bring the submenus onscreen for keyboarders (with pure CSS you can get the actual submenu item onscreen, but you can’t keep the other menu items onscreen at the same time).
If you’d like to see the effects of Javascript on a dropdown menu, check out this page with Javascript disabled, and then enable it (be sure to tab through the menu with JS off, and then JS on, to see the difference).
However, IE is over 100 years old in web years, so you can pretty safely ignore it now. (Ducks and braces himself for flame throwers.
FLAMES!!!1
Since I’m going ahead and supporting the .000005% of my users who may be blind and using a screen reader, I’m sure as heck going to support those who cannot upgrade their IE or use another browser (and I have almost 20% of these people, not ignorable).
Regarding JavaScript the web site I am redesigning currently uses a JavaScript shopping basket system called JShop. Some of our customers have called us saying “the prices at your web site appear as ‘undefined’” and this is due to JavaScript. So they could not purchase online!
Yes, Magento I find especially guilty. All communication with the server should be done via forms with submits and POSTs. If you want schmancy with that, you use a technique known as “Hijax”: Javascript, if enabled, stops the form submission and replaces it with some Javascript version instead. Users with JS on get the whatever-is-better-about-it experience… users without still get working forms. I can order stuff on Amazon.com without Javascript.
Is JavaScript less of an issue with navigation bars? I dont want to design a navigation bar that says ‘undefined’ because I am using JavaScript? Could this be the case?
It won’t say undefined, it just won’t drop down if it requires JS to drop down.
The bad menus have href=“#” in the top-level items, so without JS you don’t get anywhere : (