<html>
<head>
<!-- [If IE]><script>alert('IE!')</script><![endif] -->
</head>
<body>
<p>
Hello World
</p>
</body>
</html>
Is there something wrong with this, or do I need to add a DOCtype / meta heading to get it to work?
This is just to clarify (since noone has really).
It’s the space between
<!--and[If IE]aswell as the space after[endif]that breaks your code. It’s not there in any of the answers that are previous to mine, therefor they work and yours do not.Bad:
Good:
<!DOCTYPE html>is a good practice, but not needed for this to work.