Internet Explorer 10 / IE11 – Drops Conditional Comments – Solutions

Internet Explorer 10 - Conditional CommentsIf you were expecting something good — sorry to disappoint you. This is a rant (though I tried to include some helpful code and a link for 2 methods of dealing with this). Regardless, IE10 dropping conditional comment support is OLD NEWS to many of you.

When Internet Explorer 10 was released, Microsoft decided to get rid of conditional comments.

Is this good? Or is it bad?

In my opinion — it is BAD. Conditional comments are looked at often by some developers as a bandaid to an underlying issue. And you know what? They are.

But does that mean remove them? No, not at all. It helps future-proof the browser. There are times when you truly need them.

So what do we do now?

We can use JavaScript or PHP to detect the browser and spit out a solution to the problem.

An example that utilizes JavaScript can be seen here.

And PHP for detection?

if(preg_match('/(?i)msie [10]/',$_SERVER['HTTP_USER_AGENT'])) { ...

It’s a start. Feel free to share your suggestions or comment as to why you think conditional comment support being dropped is good / bad.

Edit: Just FYI — Internet Explorer 11 (IE11) ALSO has no conditional comments, as you may have expected. You can check more information on that here from Microsoft’s website.

Incoming search terms:

  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1823 L5m6y2t16txhtPdwaxuhWiWadxW1vg8C1Y8uawZWpuMfc-c3P78DcTvE5mHHW-TR 4b5a14a734cc04d15eaccfd8746daf33ac11e6b0&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1835 omqiczzzuE8Av7OVophfAFfjsYUpEhmz2PjWHtkrZaxFZ2AGZR0XmDlh6N1Uw0P5 61373ab1b54a0c911a5eab54e6c9f589e18ee9b4&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme

No Responses

Leave a Reply

Your email address will not be published.