How to create a basic browser only to run built-in Javascript codes

Asked

Viewed 210 times

-1

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

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 the method

WebBrowser.InvokeScript

Example: Here is the Javascript code inside the HTML.

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

In the 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.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.