navigator.mozNotification

  • Revision slug: Web/API/window.navigator.mozNotification
  • Revision title: navigator.mozNotification
  • Revision id: 446861
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment Moved From Web/API/navigator.mozNotification to Web/API/window.navigator.mozNotification

Revision Content

{{ gecko_minversion_header("2.0") }}{{ MobileOnlyHeader("2.0") }}{{ non-standard_header() }}

Provides support for creating {{ domxref("notification") }} objects, which are used to display desktop notification alerts to the user. Currently, these are only supported on Firefox Mobile and Firefox OS. See Displaying notifications for an example.

Method overview

notification createNotification(in DOMString title, in DOMString description, in DOMString iconURL {{ optional_inline() }});

Methods

createNotification()

Creates and returns a notification object that can be used to display the specified message with an optional URL.

notification createNotification(
  in DOMString title,
  in DOMString description,
  in DOMString iconURL {{ optional_inline() }}
);
Parameters
title
The notification title.
description
The text to display in the notification.
iconURL {{ optional_inline() }}
A URL identifying the image to display in the notification.
Return value

A new {{ domxref("notification") }} object.

Permissions

be sure to add in your manifest file the "desktop-notification" permission

"permissions": {
    "desktop-notification":{}
}

See also

Revision Source

<p>{{ gecko_minversion_header("2.0") }}{{ MobileOnlyHeader("2.0") }}{{ non-standard_header() }}</p>
<p>Provides support for creating {{ domxref("notification") }} objects, which are used to display desktop notification alerts to the user. Currently, these are only supported on Firefox Mobile and Firefox OS. See <a href="/en/DOM/Displaying_notifications" title="en/DOM/Displaying notifications">Displaying notifications</a> for an example.</p>
<h2 id="Method_overview" name="Method_overview">Method overview</h2>
<table class="standard-table">
  <tbody>
    <tr>
      <td><code>notification <a href="#createNotification()">createNotification</a>(in DOMString title, in DOMString description, in DOMString iconURL {{ optional_inline() }});</code></td>
    </tr>
  </tbody>
</table>
<h2 id="Methods" name="Methods">Methods</h2>
<h3 id="createNotification()" name="createNotification()">createNotification()</h3>
<p>Creates and returns a notification object that can be used to display the specified message with an optional URL.</p>
<pre class="eval">
notification createNotification(
  in DOMString title,
  in DOMString description,
  in DOMString iconURL {{ optional_inline() }}
);
</pre>
<h6 id="Parameters" name="Parameters">Parameters</h6>
<dl>
  <dt>
    <code>title</code></dt>
  <dd>
    The notification title.</dd>
  <dt>
    <code>description</code></dt>
  <dd>
    The text to display in the notification.</dd>
  <dt>
    <code>iconURL</code> {{ optional_inline() }}</dt>
  <dd>
    A URL identifying the image to display in the notification.</dd>
</dl>
<h6 id="Return_value" name="Return_value">Return value</h6>
<p>A new {{ domxref("notification") }} object.</p>
<h2 id="Methods" name="Methods">Permissions</h2>
<p>be sure to add in your manifest file the "desktop-notification" permission</p>
<pre class="default prettyprint prettyprinted" style="">
<code><span class="str">"permissions"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="str">"desktop-notification"</span><span class="pun">:{}</span><span class="pln">
</span><span class="pun">}</span></code></pre>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{ domxref("notification") }}</li>
  <li><a href="/en/DOM/Displaying_notifications" title="en/DOM/Displaying notifications">Displaying notifications</a></li>
</ul>
Revert to this revision