[thelist] Browser detection and style sheets
Zoe Oughton
zoe.oughton at btconnect.com
Thu Nov 23 03:29:31 CST 2000
Hi listees
I will ask this again, but try and explain a little better :o)
I currently use different style sheets for windows IE, windows NN, Mac IE
and Mac NN.
This tends to work well, but I now wish to add another 1 or 2 style sheets,
namely one for Mac IE 5 and up, and another for Mac NN 6 and up.
I use JavaScript for browser/platform detection, the script sits in an
external js file, the script I use is:
<script type="text/javascript">
<!-- hide javascript from all non-enabled browsers.
if (parseInt(navigator.appVersion) >= 4) {
var IE4 = (navigator.appVersion.indexOf("MSIE") > 0);
var NN4 = (navigator.appName == "Netscape");
var OS;
if (navigator.appVersion.indexOf("Win") > 0) OS = "Windows";
if (navigator.appVersion.indexOf("Mac") > 0) {OS = "MacOS";}
switch (OS) {
case "Windows":
if (IE4 > 0) document.write ("<LINK href='eng/ie.css'
rel='stylesheet' type='text/css'");
if (NN4 > 0) document.write ("<LINK href='eng/nn.css'
rel='stylesheet' type='text/css'");
break;
case "MacOS":
if (IE4 > 0) document.write ("<LINK href='eng/iemac.css'
rel='stylesheet' type='text/css'");
if (NN4 > 0) document.write ("<LINK href='eng/nnmac.css'
rel='stylesheet' type='text/css'");
break;
}
}
//-->
</script>
I have tried to modify the code to add choices for the extra style sheets,
but I am no coder!!!! and have been unable to do this successfully (I nearly
got it a couple of times - but didn't work properly!!!!).
I have also searched the internet (thanks for suggestions I have already
had), but the scripts I have found (and been given) have only tended to deal
with different browsers (all on PC) I have not been able to find anything
that will deal with browsers and platforms.
I know I am thick when it comes to programming :o( but I do try. Are there
any script gurus out there who would be willing to help me with the extra
code needed to add options for extra style sheets???
I also know that browser detection can be done server side, and that this
might be a better solution. I would be quite happy to do this, but again I
am struggling to find a suitable cgi script, I have spent hours looking but
again can only find browser detection, or when I do find something that will
detect both browser and platform it is not shown how to use the script for
what I want.
Am I the only one who wants different style sheets depending on platform as
well as browser????
Zoe
^^^^^^^^^^^^^^^^^^^^^^^^^^
Zoe Oughton
zoe.oughton at btconnect.com
~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the thelist
mailing list