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
Custom Response Handling |
By default, when EO.WebBrowser receives a response with an MIME type that it can neither handle by itself nor by a plug-in, it treats the response as a download and triggers the download related events. You can implement your own custom resource handling logic through these events. For example, you can launch an application to open the downloaded file after the download is finished.
You can also handle the WebView's ShouldForceDownload event to force the WebView to treat the response as a download. The following code demonstrates how to handle a PDF file as a download (by default, the WebView will load Adobe Reader plug-in to display the PDF file):
//Connect the event handler page.WebView.ShouldForceDownload += new ShouldForceDownloadHandler(WebView_ShouldForceDownload); void WebView_ShouldForceDownload(object sender, ShouldForceDownloadEventArgs e) { //Force download PDF files. You can also check e.Url //to force download certain Urls if (e.MimeType == "application/pdf") e.ForceDownload = true; }
Once a response is forced to be treated as a download, the download related events will fire. You can then handle those events to implement your custom handling logic.