• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

<Head> ’Em Off

Dreamweaver includes a pretty flexible behavior called Check Browser that stays on the current page or redirects the user to a different page, depending on the browser version. When you apply the Check Browser behavior, it is triggered by the onLoad event of the <body> tag; in other words, after the page has finished loading, the JavaScript code checks the browser and redirects the page according to your settings. This is all well and good if one of your options is to stay on the same page—but what if you’ve got two separate pages you’re redirecting to? With the standard Dreamweaver implementation, the page has to load before it redirects; even if the page is blank, you may get a little flash of the page before the redirection kicks in. The way around this is to move the function call that Dreamweaver inserted in the <body> tag up to the <head>. To do this, locate the onLoad event in the <body> tag; it’ll look something like this:

<body
onLoa="MM_checkBrowser (4.0,1,2,4.0,0,2,2, 'main.htm', 'altmain.htm');return document.MM_returnValue">


					  

Copy the bolded code from your own <body> tag and paste it within the <script> tag in the <head>, just above the line that starts with function MM_checkBrowser. You also need to delete the entire onLoad event in the <body> tag. Now, just like with a server-side redirection script, the redirection takes place in the blink of an eye—without the flash of a page.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint