質問

I want to only load the html5shiv.js file if the web browser is less than IE 9.

The code I have is

<doctype html>
 <html>
 <head>
  <!--[if lt IE 9]
      <script type="text/javascript" src="html5shiv.js"></script>
  -->
 </head>
 <!-- ... -->
</html>

When I test to see if this works or not (I do this by changing the Browser Mode option to a version lower than IE 9 in Developer Tools - I'm not clear as to whether this works or not.

Does this work for you - or is the code atleast right?

役に立ちましたか?

解決

You may be missing a chevron at the end of the first line and the closing tag:

<!--[if lt IE 9]>
 <script type="text/javascript" src="html5shiv.js"></script>
<![endif]-->
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top