Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Netscape Communicator
Expertise: Beginner
Mar 19, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Disabling Netscape Toolbar Functions

Is there any way with HTML, JavaScript, Java or whatever to disable the "Back" and "Forward" buttons in the Netscape toolbar? As content on the Web enters the realm of real applications, screen traversal becomes important. Hitting those buttons cause navigation issues and can confuse the user.

There is no way to disable the toolbar from Java -- for good reason. Keep in mind that Java is not tied to any particular browser or operating system, and therefore should not depend on the particular user-interface implementations of Netscape or Hotjava or Internet Explorer. There may not be a forward or backward button at all -- stand-alone Java applications or Java's Appletviewer certainly don't have forward/back buttons and future browsers may have much more sophisticated navigation controls than just forward/back buttons.

The problem you mention is valid, however. How does one make it easy to use a real-life application on the Web without running into a UI disaster? For instance, when the user leaves the page, should the applet be killed or should it keep running but suspend itself? What if you bring up another copy of that page while the old instance of the applet is already running? One solution is to advise the user to spawn a new browser window for an applet that might stay on the screen for a while. This is rather clumsy especially because multiple browser windows clutter up the screen very quickly and are hard to manipulate.

Fortunately, Java does give the programmer quite a bit of control over an applet's behavior as the user navigates the web. This is provided through three methods in the Applet class: start(), stop(), and destroy(). The programmer can override the default implementations of these methods to clean up or initialize the applet as needed.

The stop() method is called whenever the applet disappears from view - either because the user went to a different page or because the browser was iconified. The start() method is called whenever an applet is just about to start, or comes back into view -- when the user clicks on the back button or when the browser is deiconified, for example. Finally the destroy() method is called whenever the applet's page drops off of the user's history list such that there is no way for the user to get back to the page by pressing the back button.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date