htmlinternet-explorerscript-tag

How do <scripts> load inside of comment tags?


The following code is in head section of a page:

<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

Shouldn't the comment tags stop this script from being run?


Solution

  • It's called Conditional Comments

    https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx http://www.quirksmode.org/css/condcom.html

    Only works with Internet Explorer.