Page Actions
Wiki Actions
User Actions
Submit This Story

Get Client IE info

Many ppl in this world are still suffering from ancient Web Browser Like IE6.
Web developer suffers to, web noob like me is also suffeering…


Lucky that since IE 5.5 M$ has provided a unique “Conditional Comments” feature.
Here is how it works, in html:

Code Sample

<p>
<!--[if IE]>
This is Internet Explorer<br />
<![endif]-->
<!--[if IE 5]>
this is Internet Explorer 5<br />
<![endif]-->
<!--[if IE 5.0]>
this is Internet Explorer 5.0<br />
<![endif]-->
<!--[if IE 5.5]>
this is Internet Explorer 5.5<br />
<![endif]-->
<!--[if IE 6]>
this is Internet Explorer 6<br />
<![endif]-->
<!--[if IE 7]>
this is Internet Explorer 7<br />
<![endif]-->
<!--[if gte IE 5]>
this is Internet Explorer 5 and up<br />
<![endif]-->
<!--[if lt IE 6]>
this is Internet Explorer lower than 6<br />
<![endif]-->
<!--[if lte IE 5.5]>
this is Internet Explorer lower or equal to 5.5<br />
<![endif]-->
<!--[if gt IE 6]>
this is Internet Explorer greater than 6<br />
<![endif]-->
</p>

Browsers other than IE will totally ignore these since they appear to them as html comments.

Negative Conditions

Negative condition is also supported:

<![if !IE]>
A beautiful world that IE holds you from...
<![endif]>

Live Sample

If you peek in the wiki source of main page of my site you'll see that I use this to load Google Friend Connect for non-IE readers.

For more info, see Anti IE6 Campaigns

 
blog/2009/11/get_ie_info.txt · Last modified: 2009/11/01 00:00 (external edit)     Back to top
Recent changes RSS feed Creative Commons License Powered by PHP Driven by DokuWiki