Question

In modern web pages you often see something like:

<!--[if IE 7]>
<html class="ie ie7" lang="en-US">
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" lang="en-US">
<![endif]-->
<!--[if !(IE 7) | !(IE 8)  ]><!-->
<html lang="en-US">
<!--<![endif]-->

The purpose is obviously to apply different html, depending on browser and browser version. I assume this is done server side, as it seems everything except the appropriate parts are commented out.

What software is used on the server to select which part to comment out depending on the visiting browser?

Was it helpful?

Solution

Those are conditional comments. They are parsed (contrary to the HTML spec), client side, by Internet Explorer (versions 5-9). Everything else (including IE 10) treats them as regular comment syntax.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top