HtmlElement script = webBrowser.Document.CreateElement("script");
script.SetAttribute("type", "text/javascript");
script.SetAttribute("text", "function _func(){alert('OK')}");
HtmlElement head = webBrowser.Document.Body.AppendChild(script);
webBrowser.Document.InvokeScript("_func");

  webbroswer  后台注入脚本

05-11 09:23