Basic Browser Detection

This tests the Apache if-elif-else-endif SSI flow control construct for use in broser detection. The core of the code is:
<!--#if expr="$HTTP_USER_AGENT = /6.\(.*\)/" -->
<H2>You are using a browser with version number 6.xx</H2>
<!--#elif expr="$HTTP_USER_AGENT = /5.\(.*\)/" -->
<H2>You are using a browser with version number 5.xx</H2>
<!--#elif expr="$HTTP_USER_AGENT = /4.\(.*\)/" -->
<H2>You are using a browser with version number 4.xx</H2>
<!--#elif expr="$HTTP_USER_AGENT = /3.\(.*\)/" -->
<H2>You are using a browser with version number 3.xx</H2>
<!--#elif expr="$HTTP_USER_AGENT = /2.\(.*\)/" -->
<H2>You are using a browser with version number 2.xx</H2>
<!--#else -->
<H2>I don't know what you're using</H2>
<!--#endif -->
Your HTTP_USER_AGENT = <!--#echo var="HTTP_USER_AGENT" -->
This outputs:

You are using a browser with version number 6.xx

You are using a browser with version number 5.xx

You are using a browser with version number 4.xx

You are using a browser with version number 3.xx

You are using a browser with version number 2.xx

I don't know what you're using

More Elaborate Browser Detection

The SSI conditional expressions can be made more complex to detect the operating system as well as the browser vendor/version.
<!--#if expr="$HTTP_USER_AGENT = /Windows NT 5.1/ && $HTTP_USER_AGENT = /MSIE/" -->
<H2>You are using Windows XP and MS I.E. 6.0</H2>
<!--#elif expr="$HTTP_USER_AGENT = /Linux/ && $HTTP_USER_AGENT = /Gecko/" -->
<H2>You are using Linux and some Netscape 6.x/7. or Mozilla variant</H2>
<!--#elif expr="$HTTP_USER_AGENT = /Win/ && $HTTP_USER_AGENT = /MSIE/ && $HTTP_USER_AGENT = /4./" -->
<H2>You are using MS Windows and MS I.E. 4.0</H2>
<!--#elif expr="$HTTP_USER_AGENT = /Win/ && $HTTP_USER_AGENT = /MSIE/" -->
<H2>You are using MS Windows and a pre 4.0 version of MS I.E.</H2>
<!--#elif expr="$HTTP_USER_AGENT = /Win/ && $HTTP_USER_AGENT != /ompatible/ && ( $HTTP_USER_AGENT = /4./ )" -->
<H2>You are using MS Windows and Netscape 4.0</H2>
<!--#elif expr="$HTTP_USER_AGENT = /Win/ && $HTTP_USER_AGENT != /ompatible/ && ( $HTTP_USER_AGENT = /3./ )" -->
<H2>You are using MS Windows and Netscape 3.0</H2>
<!--#elif expr="$HTTP_USER_AGENT = /Win/ && $HTTP_USER_AGENT != /ompatible/" -->
<H2>You are using MS Windows and pre-3.0 Netscape</H2>
<!--#elif expr="$HTTP_USER_AGENT = /ac/ && $HTTP_USER_AGENT = /MSIE/" -->
<H2>You are using Macintosh and MS I.E.</H2>
<!--#elif expr="$HTTP_USER_AGENT = /ac/ && $HTTP_USER_AGENT != /ompatible/" -->
<H2>You are using Macintosh and Netscape</H2>
<!--#else -->
<H2>I don't know what you're using</H2>
<!--#endif --> 
This outputs:

You are using Windows XP and MS I.E. 6.0

You are using Linux and some Netscape 6.x/7. or Mozilla variant

You are using MS Windows and MS I.E. 4.0

You are using MS Windows and a pre 4.0 version of MS I.E.

You are using MS Windows and Netscape 4.0

You are using MS Windows and Netscape 3.0

You are using MS Windows and pre-3.0 Netscape

You are using Macintosh and MS I.E.

You are using Macintosh and Netscape

I don't know what you're using

You are using HTTP_USER_AGENT =

Other resources: