Logo
My Account |  Site Map | Contact Us  

Accessing JavaScript Objects from .NET Code with EO.WebBrowser

All Products
EO.Web Controls
EO.Pdf for .NET
EO.Wpf for .NET
EO.WebBrowser for .NET
For Win Forms App
For WPF Apps
Custom Context Menu
.NET -> JavaScript
JavaScript -> .NET
Resource Handler
TabbedBrowser Sample
EO.WebBrowser allows you to execute JavaScript code, directly access JavaScript objects, or call JavaScript functions all from your .NET code. The following code demonstrates how to use this feature:
C# VB.NET  
//Execute JavaScript code alert('hi');
webView1.EvalScript("alert('hi');");

//Return the current page Url
string url = (string)webView1.EvalScript("document.URL");

//Get the JavaScript window object
JSObject window = webView1.GetJSWindow();

//Get the alert JavaScript function
JSFunction alert = (JSFunction)WebView1.EvalScript("alert");

//Call the function
alert.Invoke(window, new object[]{"Hi"});

See here for detailed information on how to access JavaScript objects from .NET code.

Additional Resources

  • Product Documentation

    All features are explained in great details in the product documentation. It also contains complete reference information for each type, property or method;

  • Samples

    The download package contains a wide variety of samples with full C# and Visual Basic.NET source code that demonstrate how to use different feature of the EO.WebBrowser library.

  • Technical Support

    Still have questions? Post in our support forum or contact us and we will answer them quickly. Our turn around time is among the best in the industry.