mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
webview: add permission-request event
This commit is contained in:
@@ -167,6 +167,14 @@ A list of strings which specifies the blink features to be enabled separated by
|
||||
The full list of supported feature strings can be found in the
|
||||
[setFeatureEnabledFromString][blink-feature-string] function.
|
||||
|
||||
### `disablewebnotification`
|
||||
|
||||
```html
|
||||
<webview src="https://www.github.com/" disablewebnotification></webview>
|
||||
```
|
||||
|
||||
If "on", the guest page will have web notifications disabled.
|
||||
|
||||
## Methods
|
||||
|
||||
The `webview` tag has the following methods:
|
||||
@@ -736,4 +744,22 @@ Emitted when DevTools is closed.
|
||||
|
||||
Emitted when DevTools is focused / opened.
|
||||
|
||||
### Event: 'permission-request'
|
||||
|
||||
Returns:
|
||||
|
||||
* `permission` String - The type of permission being requested. Enum of 'media', 'webNotification'.
|
||||
* `allow` Function - Allows the permission.
|
||||
* `deny` Function - Deny the permission. This is the default behaviour if `allow` is not called.
|
||||
|
||||
Emitted when guest page requires special permission.
|
||||
|
||||
```javascript
|
||||
// This will deny guest page access to the webkitGetUserMedia API.
|
||||
webview.addEventListener('permission-request', function(e) {
|
||||
if (e.permission === 'media')
|
||||
e.deny();
|
||||
});
|
||||
```
|
||||
|
||||
[blink-feature-string]: https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/platform/RuntimeEnabledFeatures.cpp&sq=package:chromium&type=cs&l=527
|
||||
|
||||
Reference in New Issue
Block a user