Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Permissions

Permissions

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨September 2022⁩.

* Some parts of this feature may have varying levels of support.

Note: This feature is available inWeb Workers.

ThePermissions interface of thePermissions API provides the core Permission API functionality, such as methods for querying and revoking permissions

Instance methods

Permissions.query()

Returns the user permission status for a given API.

Permissions.revoke()Deprecated

Revokes the permission currently set on a given API.

Example

js
navigator.permissions.query({ name: "geolocation" }).then((result) => {  if (result.state === "granted") {    showLocalNewsWithGeolocation();  } else if (result.state === "prompt") {    showButtonToEnableLocalNews();  }  // Don't do anything if the permission was denied.});

Specifications

Specification
Permissions
# permissions-interface

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp