Search code examples
javascriptinternet-explorerversioningconditional-comments

IE version check stopped working


I have just released a new version of a web app into test (maven based java app). It checks for old versions of IE and displays a box warning that it is out of date if less than version 9. This is working fine on live and UAT and as far as I can see I haven't changed the relevant files at all - home.jsp, with included header.jspf containing the 'code' (the css file is being found as the warning is contained in the usual format).

Essentially the following should run and does run in live and UAT but on my new release the warning is displaying even when I access the page using IE11.

 <!--[if lt IE 9]>
<div class="alert alert-warning text-center">
    <p>We have detected that you are using an out of date browser.</p>
</div>
<![endif]-->

If I point the same browser to UAT (the previous version) the warning disappears. I'm sure this is the same header.jspf file as I merged it back in from the main git branch as there had been a tiny formatting change while development had been on-going.

Presumably as this is processed by the browser this can't be anything to do with the server set up (it is running on a new 'devtest' server). As I don't think anything has changed or is different to previous versions I'm at a bit of a loss. Can anyone point me in the right direction?


Solution

  • There is no support of conditional comments for IE10+:

    Conditional comments only work in IE, and are thus excellently suited to give special instructions meant only for IE. They are supported from IE 5 up until IE9 (inclusive).

    <html>
      <!--[if IE]>
        This content is ignored in IE10 and other browsers.
        In older versions of IE it renders as part of the page.
      <![endif]-->
    </html>
    

    MSDN