[thelist] SSI if statements not working

Saila, Craig Craig.Saila at bgminteractive.com
Fri Oct 11 12:25:01 CDT 2002


> -----Original Message-----
> From: { schaapy } [mailto:list01 at theparagon.org]
> Sent: October 11, 2002 10:35 AM

> I need a script that can detect which browser is being used
> and then spit out the appropriate text.

<!--#set var="ua" value="$HTTP_USER_AGENT" -->
<!--#if expr="(${ua} = /.*MSIE.*/) || (${ua} = /.*Gecko.*/) || (${ua} =
/.*Opera\/[4-9].*/) || (${ua} = /.*Konqueror.*/)" -->
 <!--#include file="inc/navigation.txt" -->
<!--#elif expr="(${ua} = /.*Mozilla\/4.*/)" -->
 <!--#include file="inc/nn4x_navigation.txt" -->
<!--#else -->
  <!--#include file="inc/navigation.txt" -->
<!--#endif -->

This one will detect IE, newer Netscapes, Mozilla, Opera, Konqueror and
serve up the "navigation.txt".

Any browser with UA string with "Mozilla/4." will get "nn4x_navigation".


Any other browser gets "navigation.txt" (this could be changed to
whatever file name you want.

You can add more browsers to either by adding another UA string chunk
between the .*.*:
(${ua} = /.*.*/)

To get this working, your server must support XSSI, and probably the
file should have the extension of .shtml

Good luck.

--
Cheers,

Craig Saila
------------------------------------------
craig at saila.com : http://www.saila.com/
------------------------------------------



More information about the thelist mailing list