[thelist] javascript and SSI
Jamie Madden
jamie at bayou.com
Fri Jul 14 13:32:19 CDT 2000
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
More information about the thelist
mailing list