RE: Browser's Back button and BASE HREF

by Keith Purtell <kpurtell(at)vantagemed.net>

 Date:  Wed, 23 Feb 2000 09:13:52 -0600
 To:  <hwg-languages(at)hwg.org>
 In-Reply-To:  digitaldaze
  todo: View Thread, Original
For the benefit of anyone searching the archives, I've attached the code
that Cyanide _7 (leo7278(at)hotmail.com) developed, which restored normal
functionality to the Back button.

Keith Purtell, Web Designer
VantageMed Corporation
http://www.vantagemed.net/


<html>
<head>
        <title>navigation js</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// settings and defaults

var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);

var correctwidth = 800;
var correctheight = 600;

var high = "nav_hires.html";
var low = "nav_lowres.html";

var dest = low;
var redirected = false;

// browser and screen res tests

if ((browserName.indexOf("Netscape")!=-1 ||
     browserName.indexOf("Microsoft")!=-1) && browserVer >= 4){
  if (screen.width >= correctwidth || screen.height >= correctheight){
    dest = high;
  }
} else if (browserName.indexOf("Netscape")!=-1 && browserVer >= 3){
  var screen_size = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
  if (screen_size.width >= correctwidth || screen_size.height >=
correctheight){
    dest = high;
  }
}

// End -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.1">
<!--  use replace for JS1.1
if(!redirected){
  redirected = true;
  location.replace(dest);
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!-- else use href assignment
if(!redirected){
  redirected = true;
  location.href = dest;
}
//-->
</SCRIPT>
</head>

<body> </body>

</html>

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA