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.