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?

4
  • 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. Commented Oct 11, 2019 at 18:40
  • The code you tried isn't VBScript. Please clarify if you plan on using VBScript or VB.NET Commented Oct 11, 2019 at 18:41
  • 2
    Probably this Q/A will be helpful stackoverflow.com/questions/1437251/… Commented Oct 11, 2019 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). Commented Oct 11, 2019 at 19:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.