JavaScript

Last modified: 10 February 1998.

JDK 1.1 Browser Detection

Different HTML is needed to run Hi HelpIndex for browsers that are fully JDK 1.1 aware. The following JavaScript code detects whether the browser is IE4 and if so runs the JDK 1.1 version. This technique can be extended for other browsers quite easily.

Replace your HTML APPLET tag with:

<script>
<!--
// script to detect whether browser can run JDK 1.1 jar files
// IE4 is detected
bN = navigator.appName;
bV = parseInt(navigator.appVersion);
if( ((bN=="Microsoft Internet Explorer") & (bV>=4))
//    || ((bN=="Netscape") & (bV>=4)) Navigator 4 does not run JDK 1.1 fully yet
	)
{ // JDK 1.1
document.write("<APPLET code=COM.phdcc.hi.HelpIndex width=70 height=80 archive=\"hi230.jar\" alt=\"HelpIndex site index\">");
}
else
{ // JDK 1.0
document.write("<APPLET code=HelpIndex width=70 height=80 archive=\"hi210.jar\" alt=\"HelpIndex site index\">");
}

<!-- end of script -->
</script>
Note carefully that the CABBASE parameter is only written for the JDK 1.0 browsers.

Current URL Detection

You may want to pass the current URL to Hi HelpIndex, eg as a part of one of the indexN parameters.

In JavaScript, use the document.location value to obtain the full current URL. You may want to strip off all the directory information using string functions lastIndexOf() and subString().


HelpIndex    PHD