Please Note:
HierMenus is protected by copyright laws. Use of the HierMenus code requires a paid licensing agreement.
Click Here to Register

Site Navigation
Bulletins
About
Documentation
FAQ
Samples
Known Issues
Technology Jobs

internet.commerce

Partner With Us
Rackmount LCD Monitor
Hurricane Shutters
Promote Your Website
Televisions
Data Center Solutions
Holiday Gift Ideas
Home Improvement
Memory
PDA Phones & Cases
Find Software
Condos For Sale
Domain registration
Desktop Computers
Web Design

          
internet.com

IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

 
HierMenusCentral Enhance the Functionality of Your Web Site with DHTML HierMenus.
    

home / faq / faq 14

Frequently Asked Question #14

Question: What is this HM_f_DoNothing code, and why must I insert it at the top of each of my configuration files?

Answer: As explained as part of step 2 of the setup instructions, every configuration file must begin with the following block of code:

function HM_f_DoNothing() {return;}
if(typeof(HM_f_UpdateDefaults)=="undefined") {
	HM_f_UpdateDefaults=HM_f_DoNothing;
	HM_f_SetMenuTemplate=HM_f_DoNothing;
	HM_f_SetMenus=HM_f_DoNothing;
	HM_f_SetItems=HM_f_DoNothing;
}

And while this step is covered in the setup instructions, the full reason why this code is necessary is not. That we'll provide now.

When loading the HierMenus scripts into the page, we use a two step process. First, HM_Loader.js is loaded into the page, by way of the standard HTML tag that you must insert into each of your HierMenus pages:

<script type="text/javascript"
        language="JavaScript1.2"
        src="/hm/scripts/HM_Loader.js">
</script>

Within HM_Loader.js, two (or more) files are additionally loaded into the page using standard document.write JavaScript statements. When loading scripts into a page via this method, however, each of the two latest major browsers (Internet Explorer and Mozilla/Gecko) can process the scripts slightly differently than they would if the scripts were loaded directly within the page (as HM_Loader.js is) or if the scripts were simply embedded within the page. The key difference is this: in both browsers, when loading multiple scripts into a page via document.write statements (as we do in HierMenus), if the loading process of the page is stopped (via the user clicking the stop button or the user clicking through to a new page) there is the possibility that the browser will actually parse and execute one of the later external scripts--even though a prior script never finished loading--just before the page is actually unloaded. In the case of HierMenus, our second script--namely, your configuration file--relies on routines that are defined within the first script loaded--namely the HierMenus execution scripts. If the second JavaScript is parsed without the benefit of having the first JavaScript already parsed and executed, the results will be errors as the configuration file commands attempt to execute functions that, as far as the browser is concerned, don't actually exist.

Presumably, this later-before-former JavaScript parsing only happens when the two scripts in question are of significantly different sizes. When scripts are loaded into a page via document.write commands, most browsers can make the overall download of the page more efficient by retrieving both scripts simultaneously, in the same manner that multiple images of a page can be retrieved simultaneously. Though multiple retrieval requests are made for the scripts on the page, the actual processing of the scripts (and parsing of any further HTML) is delayed, so that the scripts can be executed in the proper order. In this one case, however, if the retrieval of the first script is interrupted before it is completed but after the retrieval of the second script is complete then the second script can be quickly parsed and executed after the stop button is clicked or just before the current page is unloaded and the new page is loaded.

There are many ways to work around this problem, and we've chosen a way that we thought would be the easiest to explain and implement for all HierMenus configurations. Unfortunately, it's impossible for us to fix the problem using code within the HM_Loader.js or the execution scripts; since the fact is, at the point the problem occurs it's possible that neither of them will be available to the configuration file commands. (Gecko, for example, will occasionally throw an error at a point after the HM_Loader.js code has already been removed from the page.) Basically, the HM_f_DoNothing code above provides "dummy" function declarations for each of the main commands in the configuration file if and only if they are not already declared. In this way, if the execution scripts never finished loading, the commands in the configuration file will still be executed, but they will simply "do nothing." No menus will be created (as was the user's intention, since they clicked the stop button), but no errors will be generated, either.

Of course, if you would like to implement your own checks based on the information above, you are welcome to do so.



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
Created: 3/25/2004
Updated: 3/25/2004
URL: http://www.hiermenuscentral.com/documentation/faq/faq14.html