Forum Moderators: open

Message Too Old, No Replies

Conditional comments and multiple local versions of IE

Potential problem area for multiple installs of IE

         

grahamstewart

11:23 pm on Mar 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just ran into a bit of a problem while testing a site of mine so I thought I'd bring it up as an issue to avoid other people wasting there time on it.

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?

Krapulator

4:59 am on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I assume you mean apart from not using IE specific code altogether :)

Krapulator

5:38 am on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On the serious side - one other limitation I've found with running multiple versions of IE is that I cannot access HTTPS with any of the old versions.

grahamstewart

8:35 am on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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).

Hester

9:44 am on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just use the conditional comments "if IE". By leaving out the version number (as I always have - CSS itself can be used to serve the different versions) then it will apply for all IE browsers whether installed separately or not.

grahamstewart

10:03 am on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.

Hester

10:43 am on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah I meant with the "
* html #name {}
" trick. Since IE6 isn't likely to be changed any more, I'd say that's safe to use.

grahamstewart

10:48 am on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Something to remember to re-test when IE7 comes along though.
(or the rumoured IE6.x with the rumoured XP Reloaded release).

Hester

1:53 pm on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Quite.

DrDoc

6:54 pm on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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 ;)