XSSI Library

Version Detector for Javascript
Developed by Bob Lathe

I noticed on your site a couple of mentions concerning css which is the kind of thing I am trying to do, except I need something more general so it can be used with any group of files.

The following browser sniffer will deliver JavaScript files for versions 4.0x, 4.5x and 5.0x for Netscape Navigator and Microsoft Internet Explorer on the Windows and Mac platforms.

Bob

<!--

bnsDesigns xSSI Browser Detector Script                        
copyright 1999 bnsDesigns          bob@bnsdesigns.com          

***************************************************************
NOTE: Set the prefix and extension of your action file.        

The following browser sniffer will deliver JavaScript files    
for versions 4.0x, 4.5x and 5.0x for Netscape Navigator and    
Microsoft Internet Explorer on the Windows and Mac platforms.  
The scripts must be named according to the following convention
PrefixPlatformBrowserVersionExtension                          
where:                                                         
                                                               
Prefix     is the base name of the script and should be different  
           for each set of scripts.                               
Platform   is one of "Win" or "Mac".                             
Browser    is one of "NS" (Navigator) or "IE" (Internet Explorer) 
Version    is one of "40", "45" or "50" for
           versions 4.0X, 4.5X or 5.X).                                                  
Extension  is the file extension, usually ".js" or ".css".      
                                                               
E.G.       If you make a set of scripts named "test", then you      
           name them testWinIE40.js, testWinIE50.js, testMacNS40.js 
           and so forth. Set the var="Prefix" value to "test" and   
           and the var="Extension" value to ".js" (the default)     
***************************************************************

-->

<!-- Begin Browser Sniffer Filter -->
<!-- *************************************************************** -->

<!-- Set the Platform Mac or Win -->
<!--#set var="Platform" value="" -->
<!--#if expr="$HTTP_USER_AGENT = /.*.*Mac/" --> 
  <!--#set var="Platform" value="Mac" --> 
<!--#elif expr="$HTTP_USER_AGENT = /.*.*Win/" --> 
  <!--#set var="Platform" value="Win" --> 
<!--#endif  --> 

<!-- Set the Browser Navigator or Internet Explorer --> 
<!--#set var="Browser" value="" -->
<!--#if expr="($HTTP_USER_AGENT = /.*Mozilla.*/) &&
           ($HTTP_USER_AGENT != /.*compatible.*/)" --> 
  <!--#set var="Browser" value="NS" --> 
<!--#elif expr="($HTTP_USER_AGENT = /.*MSIE.*/) &&
             ($HTTP_USER_AGENT != /.*WebTV.*/)" --> 
  <!--#set var="Browser" value="IE" --> 
<!--#endif  --> 

<!-- Set the browser version --> 
<!--#set var="Version" value="" -->
<!--#if expr="$HTTP_USER_AGENT = /.*MSIE 5.*/" --> 
  <!--#set var="Version" value="50" -->
<!--#elif expr="($HTTP_USER_AGENT = /.*4\.5.*/) " --> 
  <!--#set var="Version" value="45" -->
<!--#elif expr="$HTTP_USER_AGENT = /.*4.*/" --> 
  <!--#set var="Version" value="40" -->
<!--#elif expr="$HTTP_USER_AGENT = /.*MSIE 3.*/" --> 
  <!--#set var="Version" value="30" -->
<!--#elif expr="$HTTP_USER_AGENT = /.*3.*/" --> 
  <!--#set var="Version" value="30" -->
<!--#endif  -->
<!-- *************************************************************** -->
<!--                 End Browser Sniffer Filter                      -->
   

A printer-friendly version of this article is available.
This site hand-coded for your protection.