Accurate Wayfinding with JavaScript
By Bart Marable and Raymond Simmons
As Web sites become increasingly rich and complex, creating an accurate, consistent wayfinding system becomes ever more important. Both JavaScript and frames enhance a site's navigation tools: frames, by providing a consistent space on the screen dedicated to wayfinding; and JavaScript, by providing important navigation feedback, such as rollover buttons and changeable images. But combining JavaScript and frames often yields unpredictable results. For example, JavaScript can change a navigation bar's images (to indicate the user's location in the site) and update the contents of another frame. But if the user returns to the previous page via the browser's Back button, the navigation bar will not automatically return to its previous condition. Similarly, if the user reloads the documents, the JavaScript will return the buttons to the default setting, stranding users in the middle of the site with a wrong impression of their true location.
This article presents a flexible solution to these problems that uses JavaScript to track the user's current location and automatically update the site's navigation tools. With this system, JavaScript's onload event handler can keep a JavaScripted navigation bar accurate and consistent.
A Working Example
To demonstrate this navigation system, we'll build a Web site for a fictional company, XYZ Services. The browser window for this Web site will be divided into two frames: one for navigation, and one for displaying company information.