Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 775231 of PushManager.hasPermission()

  • Revision slug: Web/API/PushManager/hasPermission
  • Revision title: hasPermission
  • Revision id: 775231
  • Created:
  • Creator: kscarfone
  • Is current revision? No
  • Comment Editorial review

Revision Content

{{SeeCompatTable}}{{ApiRef("Push API")}}

The PushManager.hasPermission() method of the {{domxref("PushManager")}} interface returns a {{jsxref("Promise")}} that resolves to the PushPermissionStatus of the requesting webapp, which will be one of granted, denied, or default.

Syntax

​PushManager.hasPermission().then(function(pushPermissionStatus) { ... } );

Example

// TBD

Specifications

Specification Status Comment
{{SpecName('Push API', '#pushmanager-interface', 'PushManager')}} {{Spec2('Push API')}} Initial definition.

Browser Compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatChrome(42.0)}} (behind a flag) {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatChrome(42.0)}} (behind a flag)

 

Revision Source

<p style="line-height: 19.0909080505371px;">{{SeeCompatTable}}{{ApiRef("Push API")}}</p>

<p style="line-height: 19.0909080505371px;">The&nbsp;<strong><code>PushManager.hasPermission()</code></strong>&nbsp;method of the {{domxref("PushManager")}} interface returns a {{jsxref("Promise")}} that resolves to the <code>PushPermissionStatus</code> of the requesting webapp, which will be one of <code>granted</code>, <code>denied</code>, or <code>default</code>.</p>

<h2 id="Syntax" style="line-height: 30px; font-size: 2.14285714285714rem;">Syntax</h2>

<pre class="brush: js" style="font-size: 14px;">
​PushManager.hasPermission().then(function(pushPermissionStatus) { ... } );</pre>

<h2 id="Example" style="line-height: 30px; font-size: 2.14285714285714rem;">Example</h2>

<pre class="brush: js" style="font-size: 14px;">
// TBD</pre>

<h2 id="Specifications" style="line-height: 30px; font-size: 2.14285714285714rem;">Specifications</h2>

<table class="standard-table" style="line-height: 19.0909080505371px;">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Push API', '#pushmanager-interface', 'PushManager')}}</td>
   <td>{{Spec2('Push API')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_Compatibility" style="line-height: 30px; font-size: 2.14285714285714rem;">Browser Compatibility</h2>

<div style="line-height: 19.0909080505371px;">{{CompatibilityTable}}</div>

<div id="compat-desktop" style="line-height: 19.0909080505371px;">
<table class="compat-table">
 <tbody>
  <tr>
   <th style="line-height: 16px;">Feature</th>
   <th style="line-height: 16px;">Chrome</th>
   <th style="line-height: 16px;">Firefox (Gecko)</th>
   <th style="line-height: 16px;">Internet Explorer</th>
   <th style="line-height: 16px;">Opera</th>
   <th style="line-height: 16px;">Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome(42.0)}} (behind a flag)</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile" style="line-height: 19.0909080505371px;">
<table class="compat-table">
 <tbody>
  <tr>
   <th style="line-height: 16px;">Feature</th>
   <th style="line-height: 16px;">Android</th>
   <th style="line-height: 16px;">Firefox Mobile (Gecko)</th>
   <th style="line-height: 16px;">Firefox OS</th>
   <th style="line-height: 16px;">IE Mobile</th>
   <th style="line-height: 16px;">Opera Mobile</th>
   <th style="line-height: 16px;">Safari Mobile</th>
   <th style="line-height: 16px;">Chrome for Android</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatChrome(42.0)}} (behind a flag)</td>
  </tr>
 </tbody>
</table>
</div>

<p style="line-height: 19.0909080505371px;">&nbsp;</p>
Revert to this revision