[thelist] no sniff. . .

Chris Blessing webguy at mail.rit.edu
Fri Mar 29 10:14:10 CST 2002


Hey there-

I think your problem is that you're not properly referencing the navigator
object when testing your conditions.  Try using a with() block like this:

with(navigator){

	if (platform.substring(0,3).toLowerCase() == 'win') {
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			document.write('<link rel="stylesheet" href="ns4.css"
type="text/css">\n');
		}

	}else if (platform.substring(0,3).toLowerCase() == 'mac') {
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			document.write('<link rel="stylesheet" href="mac4.css"
type="text/css">\n');
		}
	}
}

HTH!

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net

> hiya chris!
>
> thanks! i've updated the code to:
>
> if (navigator.platform.substring(0,3).toLowerCase() == 'win') {if
> ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
> document.write('<link rel="stylesheet" href="ns4.css"
> type="text/css">\n');
> }}
> else if (navigator.platform.substring(0,3).toLowerCase() == 'mac') {if
> ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
> document.write('<link rel="stylesheet" href="mac4.css"
> type="text/css">\n');
> }}
>
> but it still doesn't seem to sniff or write! the code's at
> http://home.earthlink.net/~frelkins/testcss/test.html i've checked it with
> 4.79 on NT and 4.6 on Mac OS 9.1.
>
> puzzled,
>
> f




More information about the thelist mailing list