// Your WebBrowser control and document
var htmlDocument = this.webBrowser1.Document;
if (htmlDocument != null)
{
HtmlElement head = htmlDocument.GetElementsByTagName("head")[0];
HtmlElement scriptEl = htmlDocument.CreateElement("script");
if (scriptEl != null)
{
IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement;
element.text = function; // 여기에 삽입할 function 작성
head.AppendChild(scriptEl);
}
}