Table of Contents
- Getting Started
- EO.Pdf
- EO.Web
- EO.WebBrowser
- Overview
- Installation and Deployment
- Getting Started
- Customizing WebView
- Advanced Topics
- Executing JavaScript Code
- JavaScript and DOM Interface
- Using JavaScript Extension
- Passing Complex Data Objects in between JavaScript and .NET
- Custom Resource Handler
- Custom Response Handling
- Handling Input Events
- Handling New Window
- Managing Browser Engines
- Setting WebView Options
- Authentication
- Working with Certificates
- Working with Local Files
- Printing Pages
- HTML 5 Support
- Using Plugins
- Debugging Web Pages
- Using Google Services
- EO.Wpf
- Common Topics
- Reference
Setting WebView Options |
EO.WebBrowser supports a number of per WebView options, such as disabling JavaScript, custom CSS styles, etc. All options are exposed through WebViewOptions object. These options can be set on application level, engine level or on each WebView individually.
Setting Options on the Application Level
The following code demonstrates how to disable JavaScript and image loading on application level:
//Disable JavaScript and image loading for all //WebView instances created after this call EO.WebEngine.WebViewOptions options = new EO.WebEngine.WebViewOptions(); options.AllowJavaScript = false; options.LoadImages = false; EO.WebEngine.EngineOptions.Default.SetDefaultWebViewOptions(options);
The code must be called before any WebView is created.
Setting Options on the Engine Level
The following code demonstrates how to disable JavaScript and image loading for a single Engine:
//Disable JavaScript and image loading for a specific Engine EO.WebEngine.WebViewOptions options = new EO.WebEngine.WebViewOptions(); options.AllowJavaScript = false; options.LoadImages = false; engine1.Options.SetDefaultWebViewOptions(options);
The code must be called before the engine starts. See here for more information on how to manage engines.
Setting Options on a Single WebView
The following code demonstrates how to disable JavaScript and image loading for a single WebView:
//Disable JavaScript and image loading for the WebView EO.WebEngine.WebViewOptions options = new EO.WebEngine.WebViewOptions(); options.AllowJavaScript = false; options.LoadImages = false; WebView1.SetOptions(options);
Note that the code must be called before the WebView has been created.