private void Form1_Load(object sender, EventArgs e) { webBrowser.Navigate("file:///C:/Users/Standardbenutzer/Desktop/Win8_HTML/win.html"); webBrowser.Navigated += webBrowser_Navigated; } void webBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e) { InjectScript(); } private void InjectScript() { string script = @"function setScript() {alert('injected');}"; appendScriptElement(script); webBrowser.Document. InvokeScript("setScript"); } private void appendScriptElement(string script) ( var headElements webBrowser.Document.GetElementsByTagName("head"); var headElement headElements[0]; var scr webBrowser.Document.CreateElement("script"); scr.SetAttribute("text", script); headElement, AppendChild(scr);