This script allows you to detect which browser your visitor is using, then loads up the correct cascading style sheet to suit. Change the name and paths, ie.css of the files (Internet Explorer) and nn.css (Netscape Navigator) to your own file names.
This script needs to go inside the <HEAD> tags.
Code:
<SCRIPT LANGUAGE = "JavaScript">
<--
var browser ='';
var version ='';
var entrance ='';
var cond ='';
/ / BROWSER?
if (browser =='') (
if (navigator.appName.indexOf ( 'Microsoft')! = -1)
browser = 'IE'
else if (navigator.appName.indexOf ( 'Netscape')! = -1)
browser = 'Netscape'
else browser = 'IE';
)
if (version =='') (
version = navigator.appVersion;
paren = version.indexOf ('(');
whole_version = navigator.appVersion.substring (0, paren-1);
version = parseInt (whole_version);
)
if (browser == 'IE' & & version> = 4) document.write ('<'+' link rel = "stylesheet" href = "ie.css" />');
if (browser == 'Netscape' & & version> = 2.02) document.write ('<'+' link rel = "stylesheet" href = "nn.css" />');
/ / ->
</ SCRIPT>
Bookmarks