0

I am looking to execute an HTML file containing Javascript code.

The .html file doesn't return anything, it just has to be executed in order for the Javascript code to be processed.

I tried to use WebRequest, without success.

Public Sub ExecuteHTMLFile(Command As String)
    Dim Url as String = "file////PC2/index.html?command=" + Command
    Dim request As HttpWebRequest = WebRequest.Create(Url)
    request.Method = "GET"
    request.GetRequestStream()

What is the best way to run this file and send it parameters from a Visual Basic script?

BigBen
  • 46,229
  • 7
  • 24
  • 40
  • You can't "execute" an HTML file. The javascript needs to be in a separate file and has to have an interpreter to execute it. – damian Oct 11 '19 at 18:40
  • The code you tried isn't VBScript. Please clarify if you plan on using VBScript or VB.NET – Étienne Laneville Oct 11 '19 at 18:41
  • 2
    Probably this Q/A will be helpful https://stackoverflow.com/questions/1437251/calling-a-javascript-function-in-the-c-sharp-webbrowser-control – Steve Oct 11 '19 at 18:41
  • Also, you cannot execute a `HttpWebRequest` against a file. Use a WebBrowser control (if you're on the Desktop side of the world). – Jimi Oct 11 '19 at 19:24

0 Answers0