The script is below
I have tried escaping the ! with \ but it makes no difference. I am fairly sure the browser is seeing the <!-- as the start of a comment, and ending the processing of the script right there. I have tried all sorts of escape techniques!
// Browser sniff -- the following code does a very simple browser check and rates the
// browser as either Internet Explorer on a Win32 platform or not, so that we
// know to use the ActiveX model, or the plug-in Model.
var sBrowser = navigator.userAgent;
if ((sBrowser.indexOf("IE") > -1) && (navigator.platform == "Win32"))
sBrowser = "IE";
sBrowser = "nonIE";
if (sBrowser == "IE")
document.write('<!--# include virtual="includes/safety.htm" -->');
else if (sBrowser == "nonIE")
document.write('<!--# include virtual="includes/safety_nonIE.htm" -->');
I think my syntax for the if - else statement is right because the first document.write does execute, and you will note either "IE" or "nonIE" appears in the middle of the page.
A test page is here
Any help getting this to work would be appreciated!