Well, since you requested it, the main idea is to read your JS file in a line, then create a script tag element and then paste it into the body. Also, do not forget to set the JS file in Copy to Output Directory from the properties window if you are using visual studio.
You have a JS file that looks like this:
alert("Include me");
You have a CS file that looks like this:
using System.Windows.Forms; using System.IO; namespace stackoverflow { public partial class Form1 : Form { public Form1() { InitializeComponent(); var path = Path.Combine(System.Environment.CurrentDirectory, "test.html"); var page = System.IO.File.ReadAllText(path); webBrowser1.Navigate(path); webBrowser1.DocumentCompleted += WebBrowser1_DocumentCompleted; } private void WebBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { var newScript = webBrowser1.Document.CreateElement("script"); webBrowser1.Document.Body.InsertAdjacentElement(HtmlElementInsertionOrientation.AfterEnd, newScript); var path =Path.Combine(System.Environment.CurrentDirectory, "test.js"); var script =File.ReadAllText(path); newScript.InnerText = script; } } }
I used an HTML file that looks like this:
<!doctype html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>Test</title> </head> <body> <div id="container"> <h1>Test Text</h1> </div> <script> </script> </body> </html>
When I did this, I got a result that looks like this: 
source share