Learn how to execute JavaScript from the .NET Side Using DotNetBrowser.
Get a free 30-days DotNetBrowser trial licence: https://www.teamdev.com/dotnetbrowser...
About DotNetBrowser:
DotNetBrowser allows embedding a Chromium-based browser to your .NET app to display and process HTML5, CSS3, JavaScript, Flash etc.
For more ideas on using an advanced browser-component in your .NET application, please see examples on DotNetBrowser support site https://dotnetbrowser.support.teamdev...
Transcript:
00:07 Create and Configure a WPF Solution with DotNetBrowser
00:13 First of all we need to create a WPF project. Then add the DotNetBrowser NuGet package and the valid licenсe file as an embedded resource.
00:14 You can find detailed instructions in the previous tutorials. (Check the links under this video)
00:26 Markup the MainWindow
00:28 Let’s add the Xml Namespace for the DotNetBrowser.Wpf library in the MainWindow.xaml
00:38 Then we need to markup the root grid in order to place the Browser component, the script text box and two execution buttons, so let's add three columns and two rows to the root grid
01:15 After that create the WPFBrowserView component, define its name and location in the root grid
01:33 Create a TextBox which will contain the JavaScript we are going to execute, set its name and location
01:47 Create the buttons which will execute the written JavaScript with and without a result, and set their names, locations and content
02:28 Implement the MainWindow Behaviour
02:30 Create the Click handlers for both execution buttons
02:53 Inside ‘ExecuteJsBtn_OnClick’ call the ‘BrowserView.Browser.ExecuteJavaScript’ method and pass the script textbox value as the argument
02:59 Inside ‘ExecuteJsAndReturnBtn_OnClick’ create the result variable. Then call the ‘BrowserView.Browser.ExecuteJavaScriptAndReturnValue’ method and pass the script textbox value as the argument
03:14 And then show the message box with the obtained result, previously converted to string
03:24 Build and Launch
#JavaScript
#.NET
#DotNetBrowser
#EmbeddedBrowsers