An XSSI Library Article

CSS Detector
Developed by Niel M. Bornstein

I was trying to do something that should be really simple ;) but it wasn't cooperating, and I have yet to find any resources that explain how to do what I wanted. I was finally able to get it to work. I thought you might want to put it in the library.

Basically, I wanted to determine what kind of browser is being used so I can decide whether to serve up stylesheets or not. Should be simple, right?

The trick is figuring out what browser supports what features, of course. This could be adapted for any feature you wanted to check. Of course, there's also the BrowserMatch directive, but I don't seem to have access to that on my server.


<!--#if expr="$HTTP_USER_AGENT=/Mozilla\/4/" -->
<!-- Netscape or MSIE 4.x -- supports CSS -->
<!--#elif expr="$HTTP_USER_AGENT=/MSIE 3/" -->
<!-- MSIE 3.x -- supports CSS -->
<!--#else -->
<!-- any other browser -- no CSS -->
<!--#endif -->

XSSI Library: