RootsWeb.com Mailing Lists
Total: 1/1
    1. [FreeHelp] Server Side Includes - Image Mapping & Browser Detection
    2. Barry Carlson
    3. Here is a little Server Side Includes (SSI) script that I developed for another project I'm working on. <!--#set var="uA" value="$HTTP_USER_AGENT" --> <!--#if expr="($uA=/MSIE/)" --> <!--#set var="cSS" value="-560px 3px" --> <!--#elif expr="($uA=/Firefox/)" --> <!--#set var="cSS" value="-152px 3px" --> <!--#elif expr="($uA=/Opera/)" --> <!--#set var="cSS" value="-288px 3px" --> <!--#elif expr="($uA=/Chrome/)&&($uA=/afari/)" --> <!--#set var="cSS" value="-8px 3px" --> <!--#elif expr="($uA=/Safari/)&&($uA!=/hrome/)" --> <!--#set var="cSS" value="-420px 3px" --> <!--#elif expr="($uA=/Mac/)" --> <!--#set var="cSS" value="-420px 3px" --> <!--#else --> <!--#endif --> Essentially the script is detecting the browser and creating some image positioning to display the logo associated with the browser. If you look at the source code of the page, you'd have little idea about what was going on, except that I have displayed the background-image positioning data in the top lefthand corner of the page. Independant of what operating system you are using, e.g. Linux, Windows or Mac, your browser will let the server know its User Agent code (string), and that information is being used to position one logo from an image containing 5 logos of the major browsers. Should the browser you are using not be either Internet Explorer, Chrome, Firefox, Opera, Mac or Safari, you will probably be left with just a blank page. http://freepages.computers.rootsweb.ancestry.com/~bristowe/xhr/ssi-test.html Should anyone be interested in how the script or the image mapping works, just ask on the list. Barry

    02/08/2011 10:58:51