DHTML Lab: HierMenus CENTRAL: Version 3.x FAQ #7 - dhtmlab.com
Frequently Asked Question #7
Entered: Feb 15, 1999
|The menus, in their frameset version, are created every time a new page appears in the main frame. Can't we cache them, or something, so that they don't have to be re-created?|
Long, DHTML Lab-type, Answer:
The question, as phrased, is a trick question. Although it ostensibly solicits a yes/no answer, it is based on common misconceptions, and assumes two fallacies to be true:
- Caching means no re-creation.
When a document, image, script, applet or other external page element is cached, it is simply stored locally. This enables a user to load it later, if it has not changed, without an additional connection with the server. That's all. A cached page is still created every time it is displayed in a browser window. It is just not transferred to the user again.
The external menu script is cached, so it is not transferred upon repeated visits to menu-enabled pages. The menus, however, like all elements, are re-rendered.
- The menus are not normal page elements.
The Hierarchical Menus are DHTML-based. That makes them HTML-based. They are part of the page they appear in. In a non-frameset document, the script adds elements to the page. In the frameset version, it adds elements to an already existing page.
Since the menus are positioned elements, they float above other elements, giving the illusion that they are an appendage, or elements external to the page. This is not true. They are as much a part of the page as a <P> or <B> tag is.
When we load a page, cached or not, the elements on the page need to be built and rendered. The menus are built upon page load. There are two ways of interpreting this:
- The menus are built after the page is built (pessimistic, half-empty approach)
- The menus are built last on the page (optimistic, half-full approach)
If you regard the menus as page elements, and not as miraculous, external, floating entities, then the time needed is not an intrusion into the user's browsing time. They are a lot faster in their load and re-creation than the popular image-based rollovers are, or a Java-based navigation system. Don't regard the time used by the menu creation as "extra time." See the page they are in as a "longer page."
With this said, it must be pointed out that we are always looking for ways to decrease the menu creation time. Future versions will, in all probability, be faster.
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.
Created: Dec 29, 1998
Revised: June 26, 2001