Thursday, 8 August 2013

Would this conditional statement work in an HTML page?

Would this conditional statement work in an HTML page?

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>
<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?

No comments:

Post a Comment