title: How to insert a META HtmlElement to an existing HEAD HtmlElement for a WinForms WebBrowser?
body: <p>I am trying to add a META element under the HEAD element on a web page loaded in the Windows Forms WebBrowser control.  I am doing this inside the DocumentCompleted event and when I set a breakpoint it is added to the HEAD element correctly. Howeverwhen I look in the web page source from the control it doesn't show it.</p>
  
  <p>Here is a code snippet from my DocumentCompleted event:</p>
  
  <pre><code>Forms.WebBrowser browser = sender as Forms.WebBrowser;
  if (browser == null) return;
  Forms.HtmlDocument htmlDocument = browser.Document;
  if (htmlDocument == null) return;
  
  Forms.HtmlElement ie8MetaElement = htmlDocument.CreateElement("META");
  ie8MetaElement.SetAttribute("content", "IE=8");
  ie8MetaElement.SetAttribute("http-equiv", "x-ua-compatible");
  Forms.HtmlElement headElement = htmlDocument.GetElementsByTagName("HEAD")[0];
  headElement.Children[0].InsertAdjacentElement(Forms.HtmlElementInsertionOrientation.BeforeBegin, ie8MetaElement);
  </code></pre>
  
  <p>Do I need to do something else after Inserting the META element into the HEAD element? I have done similar changes to the Style property on an HtmlElement and it has worked find in this event, so not sure what I am missing here.</p>