interface ICoreWebView2Experimental24
Note
This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.
Note
This an experimental API that is shipped with our prerelease SDK. See WebView2 release notes.
interface ICoreWebView2Experimental24
: public IUnknown
This is the ICoreWebView_24 Experimental interface.
Summary
Members | Descriptions |
---|---|
PostWebMessageAsJsonWithAdditionalObjects | Same as PostWebMessageAsJson , but also has support for posting DOM objects to page content. |
Applies to
Product | Introduced |
---|---|
WebView2 Win32 | N/A |
WebView2 Win32 Prerelease | 1.0.2470 |
Members
PostWebMessageAsJsonWithAdditionalObjects
Same as PostWebMessageAsJson
, but also has support for posting DOM objects to page content.
public HRESULT PostWebMessageAsJsonWithAdditionalObjects(LPCWSTR webMessageAsJson, ICoreWebView2ObjectCollectionView * additionalObjects)
The additionalObjects
property in the DOM MessageEvent fired on the page content is a ArrayLike list of DOM objects that can be posted to the web content. Currently these can be the following types and null
:
Win32 | DOM type |
---|---|
ICoreWebView2FileSystemHandle | FileSystemHandle |
nullptr | null |
The objects are posted the to web content following the structured-clone semantics, meaning only objects that can be cloned can be posted. They will also behave as if they had been created by the web content they are posted to. For example, if a FileSystemFileHandle is posted to a web content it can only be re-transferred via postMessage to other web content with the same origin. Warning: An app needs to be mindful when using this API to post DOM objects as this API provides the web content with unusual access to sensitive Web Platform features such as filesystem access! Similar to PostWebMessageAsJson the app should check the Source
of WebView2 right before posting the message to ensure the message and objects will only be sent to the target web content that it expects to receive the DOM objects.