Skip to content

Instantly share code, notes, and snippets.

@nemisj
Last active February 16, 2017 19:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemisj/d03bd6f62c0d4f0925db to your computer and use it in GitHub Desktop.
Save nemisj/d03bd6f62c0d4f0925db to your computer and use it in GitHub Desktop.
Conditional comments for IE in react.js
renderHead() {
return (
var comment = '<!--[if lte IE 9]><script src="/public/media.match.js"></script><![endif]-->';
<head>
<title>Website title</title>
<meta name="react-comment-hack"
dangerouslySetInnerHTML={{__html: comment}}>
</meta>
</head>
);
}
@martinratinaud
Copy link

Hi, I wanted to try this snippet but got Invariant Violation: meta is a void element tag and must neither havechildrennor usedangerouslySetInnerHTML``

Don't you have the same ?

@sergical
Copy link

Got the same as @martinratinaud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment