Hi Folks,
I'm trying to learn SSI on apache at the moment for fun and would like the browser to display an icon/graphic depending on the users OS
I thought I could use SSI to tell me the browser and OS by using
<!--#echo var="HTTP_USER_AGENT" -->
resulting in..
Mozilla/4.0 (compatible; MSIE 5.0; Linux 2.4.2-2 i686) Opera 5.0 [en]
Instead of telling the user which browser they are using I would like to dispay a seperate image for Linux and windoze users (penguin and devil).
I geuss I would have to character match to find 'Linux' or windows in the HTTP_USER_AGENT variable and then do an If / else thing to select the image.
Could anybody point me in the right direction or suggest how I could do this in bash or perl.
this is what I have come up with so far, it is VERY untidy and does not work
but is the product of an evening playing.
I have just used text to experiment with but will use images when / if it does work
<HTML>
<HEAD>
<TITLE>Stupid Page</TITLE>
</HEAD>
<body>
<!--#if expr="${HTTP_USER_AGENT} = /Linux/" -->
<!--#set var="os" value="linux" -->
<!--#elif expr="${HTTP_USER_AGENT} = /linux/" -->
<!--#set var="os" value="linux" -->
<!--#elif expr="${HTTP_USER_AGENT} = /X11/" -->
<!--#set var="os" value="linux" -->
<!--#elif expr="${HTTP_USER_AGENT} = /Konqueror/" -->
<!--#set var="os" value="linux" -->
<!--#elif expr="${HTTP_USER_AGENT} = /Windows 98/" -->
<!--#set var="os" value="win" -->
<!--#elif expr="${HTTP_USER_AGENT} = /Windows 95/" -->
<!--#set var="os" value="win" -->
<!--#else -->
<!--#set var="os" value="unknown" -->
<!--#endif -->
<!--#if expr="$os = /linux/" -->
<B>Good Stuff, Linux is so so kewl!<B>
<!--#elif expr="$os = /netscape/" -->
<B>Prepare to Blue Screen, your using Windoze</B>
<!--#else -->
Hmm, Must be a Mac or something
<!--#endif -->
</body>
</HTML>
Cheers
Mike
[Edited by mrl on 05-29-2001 at 07:09 PM]