این ترجمه ناتمام است. Please help translate this article from English

Note: This feature is available in Web Workers.

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The requestPermission() method of the Notification interface requests permission from the user for the current origin to display notifications.

Note: This feature is not available in SharedWorker


The latest spec has updated this method to a promise-based syntax that works like this:

Notification.requestPermission().then(function(permission) { ... });

Previously, the syntax was based on a simple callback; this version is now deprecated:


Safari Version 12.0.3 still uses callback to get the permission.


callback Optional Deprecated since Gecko 46
An optional callback function that is called with the permission value. Deprecated in favor of the promise return value.


A Promise that resolves to a DOMString with the permission picked by the user. Possible values for this string are granted, denied, or default.


The following snippet requests permission from the user, then logs a different result to the console depending on the user's choice.

Notification.requestPermission().then(function(result) {
  if (result === 'denied') {
    console.log('Permission wasn\'t granted. Allow a retry.');
  if (result === 'default') {
    console.log('The permission request was dismissed.');
  // Do something with the granted permission.


Specification Status Comment
Notifications API Living Standard Living standard

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
requestPermissionChrome Full support 46Edge Full support 14Firefox Full support 47
Full support 47
Notes From Firefox 70 onwards, cannot be called from a cross-origin IFrame.
Notes From Firefox 72 onwards, can only be called in response to a user gesture such as a click event.
IE No support NoOpera Full support 40Safari Full support YesWebView Android No support NoChrome Android Full support 46Firefox Android Full support YesOpera Android Full support 41Safari iOS No support NoSamsung Internet Android Full support 5.0


Full support  
Full support
No support  
No support
See implementation notes.
See implementation notes.

See also