Marius van Witzenburg "Learned my lesson in life, now setting my action to stay in life."

29Mar/100

Conditional comments for Microsoft Internet Explorer

Conditional comments only work in Explorer on Windows, and are thus excellently suited to give special instructions meant only for Explorer on Windows. They are supported from Explorer 5 onwards, and it is even possible to distinguish between IE5.0, IE5.5, IE6.0, IE7.0 and IE8.0.

My opinion, lose Internet Explorer ;-)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!--[if IE]>
According to the conditional comment this is Internet Explorer<br />
<![endif]-->
 
<!--[if IE 5]>
According to the conditional comment this is Internet Explorer 5<br />
<![endif]-->
 
<!--[if IE 5.0]>
According to the conditional comment this is Internet Explorer 5.0<br />
<![endif]-->
 
<!--[if IE 5.5]>
According to the conditional comment this is Internet Explorer 5.5<br />
<![endif]-->
 
<!--[if IE 6]>
According to the conditional comment this is Internet Explorer 6<br />
<![endif]-->
 
<!--[if IE 7]>
According to the conditional comment this is Internet Explorer 7<br />
<![endif]-->
 
<!--[if gte IE 5]>
According to the conditional comment this is Internet Explorer 5 and up<br />
<![endif]-->
 
<!--[if lt IE 6]>
According to the conditional comment this is Internet Explorer lower than 6<br />
<![endif]-->
 
<!--[if lte IE 5.5]>
According to the conditional comment this is Internet Explorer lower or equal to 5.5<br />
<![endif]-->
 
<!--[if gt IE 6]>
According to the conditional comment this is Internet Explorer greater than 6<br />
<![endif]-->

Note the special syntax:

! The "not" operator.
lt The "less than" operator.
lte The "less than or equal to" operator.
gt The "greater than" operator.
gte The "greater than or equal to" operator

I hope you will be able to fix things more easy with Internet Fucking Explorer :-P

29Mar/100

Internet Explorer 8 (IE8) compatibility view mode

Everybody knows that Internet Explorer can be a bitch... And so for IE8!

For the scripts who do not work right yet on IE8 there is a way to put IE8 in compatibility mode so you can view the website in a IE7 sorta like environment.

In PHP you have to send the following header, my advice is to add it to your first index file if you handle everything through this index.

<?php
header('X-UA-Compatible: IE=EmulateIE7');
?>

Or you can add a header in the HTML head with a meta tag.
Add this right after the <head> tag:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

In the same way specify IE=5, IE=7, or IE=8 to select one of those compatibility modes. A complete table is given below.

modes Internet Explorer 8 (IE8) compatibility view mode

I hope this makes your life with Internet Explorer a bit easier!

Ps. If you want to break this feature, you could use something like this to force IE to always be compatible:

<?php
header('X-UA-Compatible: IE=100');
?>