|
@@ -284,15 +284,17 @@ win.webContents.session.setCertificateVerifyProc((request, callback) => {
|
|
|
#### `ses.setPermissionRequestHandler(handler)`
|
|
|
|
|
|
* `handler` Function | null
|
|
|
- * `webContents` [WebContents](web-contents.md) - WebContents requesting the permission.
|
|
|
+ * `webContents` [WebContents](web-contents.md) - WebContents requesting the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin.
|
|
|
* `permission` String - Enum of 'media', 'geolocation', 'notifications', 'midiSysex',
|
|
|
'pointerLock', 'fullscreen', 'openExternal'.
|
|
|
* `callback` Function
|
|
|
* `permissionGranted` Boolean - Allow or deny the permission.
|
|
|
* `details` Object - Some properties are only available on certain permission types.
|
|
|
- * `externalURL` String - The url of the `openExternal` request.
|
|
|
- * `mediaTypes` String[] - The types of media access being requested, elements can be `video`
|
|
|
+ * `externalURL` String (Optional) - The url of the `openExternal` request.
|
|
|
+ * `mediaTypes` String[] (Optional) - The types of media access being requested, elements can be `video`
|
|
|
or `audio`
|
|
|
+ * `requestingUrl` String - The last URL the requesting frame loaded
|
|
|
+ * `isMainFrame` Boolean - Whether the frame making the request is the main frame
|
|
|
|
|
|
Sets the handler which can be used to respond to permission requests for the `session`.
|
|
|
Calling `callback(true)` will allow the permission and `callback(false)` will reject it.
|
|
@@ -312,13 +314,15 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents
|
|
|
#### `ses.setPermissionCheckHandler(handler)`
|
|
|
|
|
|
* `handler` Function<Boolean> | null
|
|
|
- * `webContents` [WebContents](web-contents.md) - WebContents checking the permission.
|
|
|
+ * `webContents` [WebContents](web-contents.md) - WebContents checking the permission. Please note that if the request comes from a subframe you should use `requestingUrl` to check the request origin.
|
|
|
* `permission` String - Enum of 'media'.
|
|
|
* `requestingOrigin` String - The origin URL of the permission check
|
|
|
* `details` Object - Some properties are only available on certain permission types.
|
|
|
* `securityOrigin` String - The security orign of the `media` check.
|
|
|
* `mediaType` String - The type of media access being requested, can be `video`,
|
|
|
`audio` or `unknown`
|
|
|
+ * `requestingUrl` String - The last URL the requesting frame loaded
|
|
|
+ * `isMainFrame` Boolean - Whether the frame making the request is the main frame
|
|
|
|
|
|
Sets the handler which can be used to respond to permission checks for the `session`.
|
|
|
Returning `true` will allow the permission and `false` will reject it.
|