You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The WebView2 team has been asked to provide support for handling permission
3
-
requests that come from iframes. These permission requests occur when content
2
+
The WebView2 team has been asked to provide support for handling permission
3
+
requests that come from iframes. These permission requests occur when content
4
4
within the iframe are requesting access to priveleged resources. The permission
5
-
request types that we support are: Microphone, Camera, Geolocation,
5
+
request types that we support are: Microphone, Camera, Geolocation,
6
6
Notifications, Other Sensors, and Clipboard Read.
7
7
8
-
We currently have a `PermissionRequested` event on our `CoreWebView2` which is
9
-
raised for any permission requests (either from webview or iframes). However,
10
-
our customers do not have a way to determine whether the request has come from
11
-
the webview or an iframe and handle these cases seperately. As such, we plan to
12
-
expand our `CoreWebView2Frame` API to include the `PermissionRequested` event
13
-
as well.
8
+
We currently have a [PermissionRequested](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2permissionrequestedeventargs?view=webview2-1.0.1020.30)
9
+
event on our `CoreWebView2` which is raised for any permission requests
10
+
(either from webview or iframes). However, our customers do not have a way to
11
+
determine whether the request has come from the webview or an iframe and
12
+
handle these cases seperately. As such, we plan to expand our
13
+
`CoreWebView2Frame` API to include the `PermissionRequested` event.
14
14
15
-
A current limitation of our `CoreWebView2Frame` API is that it only supports top
16
-
level iframes. Any nested iframes will not have a `CoreWebView2Frame`
17
-
associated with them.
15
+
A current limitation of our `CoreWebView2Frame` API is that it only supports top
16
+
level iframes. Any nested iframes will not have a `CoreWebView2Frame`
17
+
associated with them.
18
18
19
19
In this document we describe the updated API. We'd appreciate your feedback.
20
20
21
21
# Description
22
22
We propose extending `CoreWebView2Frame` to include the `PermissionRequested`
23
-
event. This event will be raised whenever an iframe requests permission to
24
-
priveleged resources.
23
+
event. This event will be raised whenever an iframe requests permission to
24
+
priveleged resources.
25
25
26
26
Additionally, we propose extending `CoreWebView2PermissionRequestedEventArgs`
27
27
to include a `Handled` property.
28
28
29
29
To maintain backwards compatibility, by default we plan to raise
30
-
`PermissionRequested` on both `CoreWebView2Frame` and `CoreWebView2`. The
31
-
`CoreWebView2Frame` event handlers will be invoked first,
30
+
`PermissionRequested` on both `CoreWebView2Frame` and `CoreWebView2`. The
31
+
`CoreWebView2Frame` event handlers will be invoked first,
32
32
before the `CoreWebView2` event handlers. If `Handled` is set true as part of
33
33
the `CoreWebView2Frame` event handlers, then the `PermissionRequested` event
34
34
will not be raised on the `CoreWebView2`, and its event handlers will not be
35
35
invoked.
36
36
37
-
In the case of a nested frame requesting permission, we will raise the event
37
+
In the case of a nested iframe requesting permission, we will raise the event
38
38
off of the top level iframe. This is due to the previously mentioned limitation
39
39
of not having `CoreWebView2Frame`'s for nested iframes.
40
40
@@ -43,20 +43,23 @@ of not having `CoreWebView2Frame`'s for nested iframes.
// ICoreWebView2PermissionRequestedEventArgs2 members
347
+
[doc_string("The host may set this flag to `TRUE` to prevent the `PermissionRequested` event from firing on the CoreWebView2 as well.\nBy default, both the `PermissionRequested` on the CoreWebView2Frame and CoreWebView2 will be fired.")]
[doc_string("PermissionRequested is raised when content in an IFrame requests permission to access some priveleged resources.\nIf a deferral is not taken on the event args, the subsequent scripts are blocked until the event handler returns. If a deferral is taken, the scripts are blocked until the deferral is completed.")]
0 commit comments