Conditional comments not identifying IE6

  • Thread starter Thread starter Michael Winter
  • Start date Start date
M

Michael Winter

A rather odd situation has come to my attention, and I'm curious to know
if I'm affected by it alone or if others do, too.

With IE5, Microsoft hijacked markup comments to allow content to be
presented to only IE, and even specific IE versions. The syntax[1] being:

<!--[if <comparison> IE <version>]>
...
<![endif]-->

where <comparison> and <version> are optional.

A simple example[2] of this feature would be:

<!--[if lt IE 6]>
<p>You are running IE 5.x.</p>
<![endif]-->
<!--[if gte IE 6]>
<p>You are running IE 6 or later.</p>
<![endif]-->

However, with IE 6 on this machine, I see the first, not the second,
paragraph.

Remarks, anyone?

Mike


[1] I noticed that the documented explanation of this feature
doesn't do a particularly good job of demonstrating version
comparisons. Indeed, the only brief example as a note near
the end:

[if IE lte 5.0000]

presents the comparison operator (lte) in the wrong location.
Perhaps this can be rectified, and a complete example
included?

<http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp>

[2] <http://mwinter.webhop.info/conditional-comments.html>
 
Hi Michael,

Could this be the answer?
All downlevel browsers ignore the entire script block and treat the entire
comment, including any HTML content, as a single HTML Comment.


Michael Winter said:
A rather odd situation has come to my attention, and I'm curious to know
if I'm affected by it alone or if others do, too.

With IE5, Microsoft hijacked markup comments to allow content to be
presented to only IE, and even specific IE versions. The syntax[1] being:

<!--[if <comparison> IE <version>]>
...
<![endif]-->

where <comparison> and <version> are optional.

A simple example[2] of this feature would be:

<!--[if lt IE 6]>
<p>You are running IE 5.x.</p>
<![endif]-->
<!--[if gte IE 6]>
<p>You are running IE 6 or later.</p>
<![endif]-->

However, with IE 6 on this machine, I see the first, not the second,
paragraph.

Remarks, anyone?

Mike


[1] I noticed that the documented explanation of this feature
doesn't do a particularly good job of demonstrating version
comparisons. Indeed, the only brief example as a note near
the end:

[if IE lte 5.0000]

presents the comparison operator (lte) in the wrong location.
Perhaps this can be rectified, and a complete example
included?
 
Could this be the answer?
All downlevel browsers ignore the entire script block and treat the entire
comment, including any HTML content, as a single HTML Comment.

No, because IE 6 - the one at issue - is not a 'downlevel' browser. IE 4
and earlier, as well as non-IE browsers are.

[snipped top-post]

Mike
 
Michael wrote on Sun, 11 Dec 2005 16:57:21 GMT:
A rather odd situation has come to my attention, and I'm curious to know
if I'm affected by it alone or if others do, too.

With IE5, Microsoft hijacked markup comments to allow content to be
presented to only IE, and even specific IE versions. The syntax[1] being:

<!--[if <comparison> IE <version>]>
...
<![endif]-->

where <comparison> and <version> are optional.

A simple example[2] of this feature would be:

<!--[if lt IE 6]>
<p>You are running IE 5.x.</p>
<![endif]-->
<!--[if gte IE 6]>
<p>You are running IE 6 or later.</p>
<![endif]-->

However, with IE 6 on this machine, I see the first, not the second,
paragraph.

Remarks, anyone?

Are you running any personal firewall software, pop-up stopper, or
anti-virus software that is masking/changing your User-Agent string? I've
just look at your page with IE6 (latest patches) on XP SP2 (latest patches)
and it shows the correct result. Get your page to display the actual
User-Agent header sent by the browser, and you should be able to spot why
it's not working.

Dan
 
On 12/12/2005 09:34, Daniel Crichton wrote:

[snip]
Are you running any personal firewall software, pop-up stopper, or
anti-virus software that is masking/changing your User-Agent string?

Nope. I wouldn't have thought that that would affect conditional
comments, anyway. However, you did remind me to post my user-agent and
version number, which I meant to do in the OP.

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; DigExt; SV1; .NET CLR
1.0.3705; .NET CLR 1.1.4322)

Version: 6.0.2900.2180.xpsp_sp2_gdr.050301-1519
I've just look at your page with IE6 (latest patches) on XP SP2 (latest patches)
and it shows the correct result.

Well, at least it isn't a general problem, though I'm still none the wiser.

Thank you both, Daniel and Rob.

Mike
 
Michael wrote on Mon, 12 Dec 2005 14:24:33 GMT:
On 12/12/2005 09:34, Daniel Crichton wrote:

[snip]
Are you running any personal firewall software, pop-up stopper, or
anti-virus software that is masking/changing your User-Agent string?

Nope. I wouldn't have thought that that would affect conditional comments,
anyway. However, you did remind me to post my user-agent and version
number, which I meant to do in the OP.

Hmm, good point, my brain was in "server side processing" mode.
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; DigExt; SV1; .NET CLR
1.0.3705; .NET CLR 1.1.4322)

Version: 6.0.2900.2180.xpsp_sp2_gdr.050301-1519

Mine is:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET
CLR 1.1.4322)

Version: 6.0.2900.2180.xpsp_sp2_gdr.050301-1519

The only difference there being the DigExt and SV1.

Well, at least it isn't a general problem, though I'm still none the
wiser.

Nor me. Something internal to IE, possibly some compatibility option you've
turned on for testing (maybe inadvertently).

Dan
 
....


Try the Show me... example on that page?

What happens with it?

In case it works notice that one difference is in the DOCTYPE headers.



Also instead of User-Agent per se perhaps a more significant
diagnostic would be

javascript:navigator.appVersion


You can get another set of browser information from

http://www.fiddlertool.com/useragent.aspx

(though for all I know some of it may be just a parsing of a received
User-Agent string)

and here

http://gemal.dk/browserspy/basic.html


HTH

Robert Aldwinckle
---
 
Try the Show me... example on that page?

What happens with it?

It works, but then it's only trying to evaluate 5.x or later, which is
what my IE 6 seems to think it is. If I save that and change the 5 to a
6, it fails again.

[snip]
Also instead of User-Agent per se perhaps a more significant
diagnostic would be

javascript:navigator.appVersion

Exactly the same as the userAgent property, without "Mozilla/" at the start.
You can get another set of browser information from

http://www.fiddlertool.com/useragent.aspx

(though for all I know some of it may be just a parsing of a received
User-Agent string)

I believe it is (it uses HTTPBrowserCapabilities from ASP .NET). It's
certainly server-side, anyway.

Uses JScript. I could use conditional comments without any versioning,
then parse the User-Agent string knowing that I only need to check for
the version, but that would still leave the browser broken.

Last night, I even reinstalled XP2 (which is supposed to be /the/ way to
fix IE), getting infected with a virus in the process, and it still
thinks it's some version of IE 5. Looks like this won't get solved.

Mike
 
On 11/12/2005 16:57, Michael Winter wrote:

[IE6 thinks it's IE5 when encountering conditional comments]

I found that the problem was caused by a corrupt registry value.

HKLM\SOFTWARE\Microsoft\Internet Explorer\Version Vector\IE

can be used to store the version number of IE. Though IE also knows its
own value internally (however, the number is apparently wrong with
IE5.5), it will defer to the registry if the value exists. For some
reason, this was set to 5.0002.

Mike
 
Back
Top