@@ -2,31 +2,28 @@ CoreWebView2Frame.FrameCreated API
2
2
===
3
3
4
4
# Background
5
- At present, WebView2 enables developers to track only
6
- first-level iframes, which are the direct child frames
7
- of the main frame. However, we're noticing WebView2
8
- customers want to manage nested iframes, such as
9
- recording the navigation history for a nested iframe.
10
- To address this, we will introduce the
5
+ At present, WebView2 enables developers to track only first-level
6
+ iframes, which are the direct child iframes of the main frame.
7
+ However, we're noticing WebView2 customers want to manage nested
8
+ iframes, such as recording the navigation history for a nested
9
+ iframe. To address this, we will introduce the
11
10
` CoreWebView2Frame.FrameCreated ` API. This new API will allow
12
- developers to subscribe to the event when a nested WebView frame
13
- is created, giving them access to all properties, methods, and
14
- events of [ CoreWebView2Frame] ( https://learn.microsoft.com/dotnet/api/microsoft.web.webview2.core.corewebview2frame )
15
- for the nested WebView frame .
11
+ developers to subscribe to the nested iframe creation event,
12
+ giving them access to all properties, methods, and events of
13
+ [ CoreWebView2Frame] ( https://learn.microsoft.com/dotnet/api/microsoft.web.webview2.core.corewebview2frame )
14
+ for the nested iframe .
16
15
17
- To prevent unnecessary performance overhead, WebView2
18
- does not track any nested WebView frames by default.
19
- It only tracks a webview2 frame if its parent webview2
20
- frame has subscribed to the ` CoreWebView2Frame.FrameCreated `
21
- API. Therefore, WebView2 developers have the flexibility
22
- to choose whether they want to track specific branches of
23
- the frame tree or all webview2 frames.
16
+ To prevent unnecessary performance overhead, WebView2 does not track
17
+ any nested iframes by default. It only tracks a nested iframe if its
18
+ parent iframe(` CoreWebView2Frame ` ) has subscribed to the
19
+ ` CoreWebView2Frame.FrameCreated ` API. Therefore, WebView2 developers
20
+ have the flexibility to choose whether they want to track specific
21
+ branches of the iframe tree or all WebView2 iframes.
24
22
25
23
# Examples
26
24
### C++ Sample
27
25
``` cpp
28
26
EventRegistrationToken m_frameCreatedToken = {};
29
-
30
27
void PostFrameCreatedEventMessage (wil::com_ptr<ICoreWebView2Frame > webviewFrame);
31
28
32
29
void ScenarioWebViewEventMonitor::InitializeEventView(ICoreWebView2* webviewEventView)
@@ -243,7 +240,7 @@ interface ICoreWebView2Frame7 : IUnknown {
243
240
/// Use `ICoreWebView2Frame.add_Destroyed` to listen for when this
244
241
/// iframe goes away.
245
242
///
246
- /// \snippet ScenarioWebViewEventMonitor.cpp FrameCreated
243
+ /// \snippet ScenarioWebViewEventMonitor.cpp AddFrameCreated
247
244
HRESULT add_FrameCreated(
248
245
[in] ICoreWebView2FrameNestedFrameCreatedEventHandler* eventHandler,
249
246
[out] EventRegistrationToken* token);
0 commit comments