Forum Moderators: open
If you are using a multiple versions of IE installed on the same machine (as described by DrDoc in this thread [webmasterworld.com]) then be aware that IE conditional comments will NOT work as expected.
As an example, the site I was testing inserts this HTML whenever it suspects the browser may be IE5.5 or earlier:
<!--[if IE 5]>
<link rel="stylesheet" type="text/css" media="all" href="/styles/ie5.css">
<![endif]-->
So that if the browser is in the IE5.* family it will get a second stylesheet that fixes the layout for the IE5 broken box model.
I tested it using my locally installed version of IE5.5 and it didn't work. A bit of detective work shows that the stylesheet was never used because the browser thought it was actually IE6.
So the lesson is..
When you have multiple installations of IE on one machine then they will respond to conditional comments as if they are IE6 (or probably whatever browser version they report in the "About Internet Explorer" dialog)
Obviously this makes the multiple installation technique less than ideal if you use conditional comments.
Any comments/suggestions/fixes?
I assume you mean apart from not using IE specific code altogether
Well yeah.. in an ideal world I wouldn't. :)
I use a PHP script so that the code only gets inserted when the User Agent string indicates that it could be a IE5.* browser - so other browsers should never see it.
Besides, using IE specific code to solve IE specific bugs doesn't seem like that bad an idea. Certainly feels cleaner to me than using a box model hack. Plus it still validates because it is hidden in comments.
Interesting one about HTTPS as well... it really does look like you can't do extensive testing on IE unless you have a bunch of machines handy (or at least multiple partitions on one hard drive).
leaving out the version number
Okay, but only IE5.* or earlier has the broken box model.
So the fix isn't required for IE6.
CSS itself can be used to serve the different versions
How? Do you mean by using the box model hack (or some other syntax hack)?
I'm using this technique specifically to avoid the box model hack,because I'd like to solve it with 'clean' code rather than relying on dodgy browser parsing and non-sensical CSS.
When you have multiple installations of IE on one machine then they will respond to conditional comments as if they are IE6 (or probably whatever browser version they report in the "About Internet Explorer" dialog)Obviously this makes the multiple installation technique less than ideal if you use conditional comments.
Any comments/suggestions/fixes?
By Jefferson, you are right! The reason for this being the fact that IE gets its version number from the registry. Now, I wonder if there is a workaround? Maybe a local reg file, or some other file that can be put in the local folder?
I'll do some digging ;)