@@ -4,7 +4,7 @@ CoreWebView2Frame.FrameCreated API
4
4
# Background
5
5
At present, WebView2 enables developers to track only first-level
6
6
iframes, which are the direct child iframes of the main frame.
7
- However, we're noticing WebView2 customers want to manage nested
7
+ However, we see that WebView2 customers want to manage nested
8
8
iframes, such as recording the navigation history for a nested
9
9
iframe. To address this, we will introduce the
10
10
` CoreWebView2Frame.FrameCreated ` API. This new API will allow
@@ -13,12 +13,14 @@ giving them access to all properties, methods, and events of
13
13
[ CoreWebView2Frame] ( https://learn.microsoft.com/dotnet/api/microsoft.web.webview2.core.corewebview2frame )
14
14
for the nested iframe.
15
15
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.
16
+ To prevent unnecessary performance implication, WebView2 does
17
+ not track any nested iframes by default. It only tracks a nested
18
+ iframe if its parent iframe(` CoreWebView2Frame ` ) has subscribed
19
+ to the ` CoreWebView2Frame.FrameCreated ` API. For a page with
20
+ multi-level iframes, developers can choose to track only the
21
+ main page and first-level iframes (the default behavior), a
22
+ partial WebView2 frames tree with specific iframes of interest,
23
+ or the full WebView2 frames tree.
22
24
23
25
# Examples
24
26
### C++ Sample
@@ -182,7 +184,7 @@ void HandleChildFrameCreated(object sender, CoreWebView2FrameCreatedEventArgs ar
182
184
CoreWebView2Frame childFrame = args.Frame;
183
185
string name = String.IsNullOrEmpty(childFrame.Name) ? "none" : childFrame.Name;
184
186
MessageBox.Show(this, "Id: " + childFrame.FrameId + " name: " + name, "Child frame created", MessageBoxButton.OK);
185
- // Make a recursive call to track all nested webview2 frames events.
187
+ // Make a recursive call to track all nested webview frames events.
186
188
childFrame.FrameCreated += HandleChildFrameCreated;
187
189
childFrame.NavigationStarting += HandleChildFrameNavigationStarting;
188
190
childFrame.ContentLoading += HandleChildFrameContentLoading;
0 commit comments