I’ve been a web developer for over seven years, and
in that time I’ve been fortunate enough to see several bad ideas go out
of fashion, including splash screens and unnecessary framesets.
However, one really bad idea that seems to be hanging around is the use
of JavaScript for dynamic navigation menus. This is bad for several
reasons – seven of the most obvious of which are listed below:
When navigation is not permanently displayed, it makes moving through a site difficult.
One
of the keys to making a site easy to use is giving visitors a clear
indication of where in the site they are now, have been, and should go
to next. Good navigation will provide all of these things, but it’s
impossible to accomplish using menus which only appear when the mouse
is over them.
It can be hidden by embedded elements, making navigation to some pages impossible.
Most
dynamically-displaying navigation goes over the top of content which is
already visible. However some content, like embedded video and Flash
animations, will not be hidden by the navigation bar, but stay on top,
with the result that parts of the navigation will be impossible to
reach.
It's not guaranteed to work in all browsers.
Some
browsers have stricter implementations of JavaScript than others, which
means that while your code may work perfectly well in IE, you’d better
be prepared for some serious testing to ensure that it works equally
well in FireFox, Mozilla, Safari, Opera and other minority browsers. If
your navigation is broken then so is your site.
It requires fine motor control and hand-eye co-ordination.
In
common with most dynamic menu systems, like Windows’ own Start menu,
getting around it requires practice and some skill with a mouse. If you
have ever done a usability study with elderly users you will find that
not everyone finds this easy. Windows does get one thing right; you can
use it fairly easily using just the arrow keys - not often the case
with JavaScript navigation.
No major site uses it.
Google, Amazon, YouTube, BBC, MSN, Yahoo!, MySpace, eBay, Wikipedia, Craigslist, IMDB; you name them, they don’t use it.
There are better ways to accomplish the same thing.
One
good thing about JavaScript is that a single script file can contain
the navigation for the entire site. When you update that file, the
whole site’s navigation updates. However, this is also the case with
any server-side scripting technology, outputting standard HTML, with
none of the drawbacks listed here.
JavaScript can be easily turned off – then your site is broken!
Since
JavaScript powers many of the things that are most unwelcome on the
web, such as pop-ups and windows that refuse to close, some people turn
it off (it’s easy to do by accessing the ‘Security’ tab in Internet
Options). In that case, most dynamic navigation stops working, and in
some cases the navigation bar disappears altogether. Statistics from
W3Schools show that 10% of the visitors to your site will have
JavaScript disabled. Since there’s no really good reason to use
JavaScript for navigation, why even run the risk that your site will be
unusable by 10% of your visitors?