title: Is there a way to introduce Internet Explorer conditional comments using JavaScript?
body: <p>I have a segment of HTML code which includes a conditional comment:</p>
  
  <pre><code>&lt;!--[if IE]&gt;
  &lt;link rel="stylesheet" ...&gt;
  &lt;[endif]--&gt;
  </code></pre>
  
  <p>This code was tested and works correctly when included in the HEAD section of the page, on the initial page rendering.</p>
  
  <p>I would like to introduce the same conditional CSS to an existing page using JavaScript in an Ajax response.</p>
  
  <p>I have tried:</p>
  
  <pre><code>var comment = document.createComment("[if IE]&gt;\n&lt;link rel=\"stylesheet\" ...&gt;\n&lt;[endif]");
  Wicket.Head.addElement(comment); //this is framework code that just appends the element to the HEAD node of the page. I debugged and verified that it's doing the appendChild(...) call.
  </code></pre>
  
  <p>The above code does not cause the stylesheet to be applied in Internet Explorer 7. Is there a way, using JavaScript, to introduce the conditional style in a way that Internet Explorer understands?</p>
  
  <p>Just to be clear, I am trying to use JavaScript to create a conditional style, <em>not</em> trying to write browser-conditional JavaScript.</p>