发布日期 2020年11月26日
DotNetBrowser 2.3
DotNetBrowser 2.3 is based on Chromium 84.
What’s New
Chromium 84
Chromium has been updated to version 84.0.4147.135.
In this Chromium build some of its features wrapped with the DotNetBrowser have been removed or changed, so this DotNetBrowser version introduces several breaking changes in the public API.
Check out the migration guide for this version to see what API has been changed/removed and what alternatives you should use instead.
Properties and fields access in JS-.NET bridge
Access the public properties and fields of a .NET object injected into JavaScript through the JS-.NET Bridge API. The JS-.NET Bridge API allows injecting .NET objects into JavaScript and to call their public methods. Starting from this version it can work with the public properties and fields as well. For example:
public class MyObject {
public string MyProperty {get; set;}
}
...
IJsObject window = frame.ExecuteJavaScript<IJsObject>("window").Result;
window.Properties["myObject"] = new MyObject();
Having that done, you can access and modify the value of the property from JavaScript:
window.myObject.MyProperty = "My value";
Drag and Drop events interception and IDataObject support
In this version the IDragAndDrop.EnterDragHandler
and IDragAndDrop.DropHandler
were added.
These handlers can be used to intercept the corresponding drag and drop events on web pages in the hardware-accelerated rendering mode.
For example:
browser.DragAndDrop.EnterDragHandler = new Handler<EnterDragParameters>(OnDragEnter);
browser.DragAndDrop.DropHandler = new Handler<DropParameters>(OnDrop);
private void OnDragEnter(EnterDragParameters arg)
{
if (arg.Event.DropData != null)
{
//Write file names to debug output.
foreach (IFileValue file in arg.Event.DropData.Files)
{
Debug.WriteLine($"OnDragEnter: File = {file?.FileName}");
}
}
}
private void OnDrop(DropParameters arg)
{
if (arg.Event.DropData != null)
{
//Write file names to debug output.
foreach (IFileValue file in arg.Event.DropData.Files)
{
Debug.WriteLine($"OnDrop: File = {file?.FileName}");
}
}
}
In .NET Framework, it is also possible to work with the IDataObject
instance in the scope of these handlers to receive and process the platform-specific representation of the dragged and dropped data. This functionality becomes available when the --enable-com-in-drag-drop
Chromium switch is specified.
See the complete examples showing how to use this functionality:
Improvements
- The default
StartDownloadHandler
implementation is now configured during theBrowserView
initialization if a customStartDownloadHandler
was not configured for the correspondingIBrowser
instance. - The default
SelectCertificateHandler
implementation was added. This implementation is configured during theBrowserView
initialization if a custom handler was not configured for the correspondingIBrowser
instance. - The
SelectCertificateResponse.Select(Certificate)
method functionality was improved. This method was previously used for the custom certificates only. Now, it will work properly for the certificates from the handler parameters. - The
UrlRequest
class was extended with the following properties:Browser
,ResourceType
,SslVersion
. All these properties can be used to obtain more information about this URL request, including the browser that initiated this request, the type of the requested resource, and the SSL version used to perform the request. SuggestedFileName
andSuggestedDirectory
were added to theSaveAsPdfParameters
. These properties can be used to obtain the suggested path to save the PDF file in theSaveAsPdfHandler
.- The DOM key events were extended with the
Character
property. Now it is possible to get the character generated by pressing the key and associated with the intercepted DOM key event. - The
INavigation.CurrentIndex
property was added. - The
Cookie.SameSite
property was added. - Support of Firebase Cloud Messaging was introduced.
- The possibility to run
chromium.exe
as a standalone application was disabled.
Fixed Issues
ShowNetErrorPageHandler
not working properly for websites with invalid certificates.- Increased page load time when loading the same page several times.
- The memory leak caused by some of the internal objects not being released after disposing Browser.
- The DoubleClick DOM events not received from the web page.
- The Visibility property binding not working properly for WPF BrowserView.
- Context menu being shown only once for the Flash objects.
- Context menu not being shown for PDF files opened in the browser.
- A few memory leaks for registering/unregistering .NET objects via JS-.NET bridge.
BrowserView
not being shown on the second TabItem after initializing.- CSS 3 cursors not displaying properly in Windows 7 and Windows 2008 R2 environments.
- The incorrect image location in WPF
BrowserView
in the hardware-accelerated mode. - Focus not being restored for WinForms
BrowserView
after displaying and closing the default dialog inBeforeUnloadHandler
.
Request evaluation license
Download DotNetBrowser 2.3 (.NET Framework)
Download DotNetBrowser 2.3 (.NET Core)
关注 @DotNetBrowser ,获取库的更新动态。
订阅我们的 RSS feed ,获取最新版本动态。