DotNetBrowser 1.13: Protocol Handler

This version of the library was extended with the features, allowing to intercept all the URL requests for both standard URL schemes (such as http, https, ftp, file), and custom schemes declared in your application. After registering a protocol handler for a scheme, all the URLs with the specified scheme loaded into the Browser will be handled by this handler.


Protocol Handler


Implementing a new custom protocol handler in DotNetBrowser is pretty simple:

 

public class HttpsHandler : IProtocolHandler
    {
        //This method should provide the response for the specified request
        public IUrlResponse Handle(IUrlRequest request)
        {
            string htmlContent = "Request Url: " + request.Url + "\n";
            return new UrlResponse(Encoding.UTF8.GetBytes(htmlContent));
        }
    }


This custom protocol handler can then be installed for the particular BrowserContext:

 

browser.Context.ProtocolService.Register("https", new HttpsHandler());

 

After the handler is installed, any URL having the https scheme will be handled by this custom handler.

See an example.


BrowserPreferences.CrashDumpDir property


The BrowserPreferences.CrashDumpDir is a read-write static property which can be used to specify the directory for storing the generated Chromium crash dumps. This property should be specified before creating any Browser or BrowserView instance in your code.


Fixed issues:

  • Heavyweight WPFBrowserView not shown properly when placed inside an Expander control. Before the fix, the BrowserView appeared to be misplaced after collapsing and restoring the Expander.
  • Heavyweight WPFBrowserView disposed improperly for the case when the Window.Closing event was canceled for a parent window.
  • The focus issue when the FireMouseEventsEnabled property was set to true in the heavyweight WPFBrowserView. Now, the drop-downs on the web page are working properly on a mouse click when this option is enabled.
  • Calculating the bounds in the heavyweight WPFBrowserView for the environments with the non-default DPI settings, causing incorrect positioning of the native window.
  • DisplayHeaderFooter property for built-in PDF printing being ignored. In the previous implementation, the headers and footers were not printed even if the option was enabled.
  • Event handlers being specified through the designer. Before the fix, specifying the event handler in the designer led to ignoring the BrowserType and URL properties.
  • Improper popup sizes provided to the PopupContainer in the environments with the non-default DPI settings.


Request evaluation licence

Download DotNetBrowser 1.13


Release date: October 18, 2017

Login to post a comment