[thelist] javascript and SSI

Bart Johnston 00217289 at bigred.unl.edu
Fri Jul 14 13:54:10 CDT 2000


The problem with this approach is that the javascript only gets parsed on
the client side (in the browser).  But the SSI needs to be done on the
server side.  What you really need is some kind of *server* side script that
could detect the browser.


Bart Johnston
Archrival Inc.
Digital Design & Communications
http://www.archrival.com



> I'm trying to include a small piece of text using SSI but I want it's
> inclusion to be dependant on a browser detect.  In simpler terms,  I want
> to detect whether or not the viewer is using a 3.x browser or a 4.x
browser
> and then include the file only if the browser version is 4.0 or
> above.  Here is what I've come up with but it doesn't work:
>
> IN THE HEAD
> <!--  to hide script contents from old browsers
> var bName = (navigator.appName);
> var bVer = parseFloat(navigator.appVersion);
>          if (bVer >= "4" )
> var go = "<!--#include virtual='/include/myway.txt'-->";
>
>          if ((bName == "Microsoft Internet Explorer") &&
> (bVer >= "4" ))
> var go = "<!--#include virtual='/include/myway.txt'-->";
>
>          if (bVer < "4")
> var go = "";
>
> // end hiding contents from old browsers  -->
>
>
> IN THE BODY
> <SCRIPT LANGUAGE="JavaScript">
> <!--
> document.write(go);
> -->
> </SCRIPT>
>
> If I replace the "<!--#include virtual='/include/myway.txt'-->" with
> "Jamie"  it will write Jamie to the screen but it will not write the
> include.  I suspect that I'm going about this entirely incorrectly.  Can
> someone help?
>
> jamie
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>





More information about the thelist mailing list