How to create a basic browser only to execute embedded JavaScript codes

-1

How can I create a basic browser in VB.NET or C # and execute JavaScript code inside it, and without showing the code? Because I wanted to hide my JS code.

    
asked by anonymous 27.05.2018 / 01:07

1 answer

0

You can use a WPF project in C # and use

<WebBrowser x:Name="MeuNavegador" Source="MeuDocumento.html" />

to manipulate the DOM and call Javascript

You can use method

WebBrowser.InvokeScript

Example: Here is the Javascript code inside HTML.

function resize() {
    alert('Hello World');
}

In WPF call:

MeuNavegador.Document.InvokeScript("resize");
During Microsoft BUILD 2018 it was announced that there will be the possibility of using EDGE as WebBrowser in WPF, WinForms, etc.

    

27.05.2018 / 01:20