title: WPF WebBrowser HTMLDocument
body: <p>I'm trying to inject some javascript code to prevent javascript error popup, but I cannot find <code>HTMLDocument</code> and <code>IHTMLScriptElement</code> in WPF:</p>
  
  <pre><code>var doc = browser.Document as HTMLDocument;
  
  if (doc != null)
  {
      //Create the sctipt element 
      var scriptErrorSuppressed = (IHTMLScriptElement)doc.createElement("SCRIPT");
      scriptErrorSuppressed.type = "text/javascript";
      scriptErrorSuppressed.text = m_disableScriptError;
      //Inject it to the head of the page 
      IHTMLElementCollection nodes = doc.getElementsByTagName("head");
      foreach (IHTMLElement elem in nodes)
      {
          var head = (HTMLHeadElement)elem;
          head.appendChild((IHTMLDOMNode)scriptErrorSuppressed);
      }
  }
  </code></pre>