WebAPI

  • Revision slug: WebAPI
  • Revision title: WebAPI
  • Revision id: 372751
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment

Revision Content

WebAPI is a term used to refer to a suite of device compatibility and access APIs that allow Web apps and content to access device hardware (such as battery status or the device vibration hardware), as well as access to data stored on the device (such as the calendar or contacts list). By adding these APIs, we hope to expand what the Web can do today and only proprietary platforms were able to do in the past.

Note: More of this documentation has been written than it looks like; links are not all added yet. We're actively working on improving this and expect to see things much better by around April 5.

Note: Please excuse our dust; we're in the process of totally revamping this page. It should be finished by the end of day Monday 1 April. Thank you for your patience!

Communication APIs

Bluetooth {{PrivilegedBadge}}
The WebBluetooth API provides low-level access to the device's Bluetooth hardware.
Mobile Connection API {{PrivilegedBadge}}
Exposes information about the device's cellular connectivity, such as signal strength, operator information, and so forth.
Network Information API
Provides basic information about the current network connection, such as connection speed.
Network Stats API {{PrivilegedBadge}}
Monitors data usage and exposes this data to privileged applications.
TCP Socket API
Provides low-level sockets and SSL support.
Telephony
Lets apps place and answer phone calls and use the built-in telephony user interface. There's a temporary page about this here: WebTelephony.
WebSMS {{PrivilegedBadge}}
Lets apps send and receive SMS text messages, as well as to access and manage the messages stored on the device.
WiFi Information API {{PrivilegedBadge}}
A privileged API which provides information about signal strength, the name of the current network, available WiFi networks, and so forth.

Data management APIs

Archive API
Support for accessing the contents of {{interwiki("wikipedia", "Zip")}} file archives in {{domxref("Blob")}} objects.
Contacts API
Provides access to the user's contacts database, with support for adding, reading, and modifying contact information.
Device Storage API
Allows apps to create, read, and change files stored in a central location on the device, such as the "pictures" folder on modern desktop platforms or the photo storage on mobile devices. Page needs to move.
FileHandle API
Provides support for writable files with locking support. Page needs moving.
IndexedDB
Client-side storage of structured data with support for high-performance searches. Docs need moving.
Settings API {{PrivilegedBadge}}
Lets apps examine and change system-wide configuration options that are permanently stored on the device.

View All...

Hardware access APIs

Ambient Light Sensor API
Provides access to the ambient light sensor, which lets your app detect the ambient light level in the vicinity of the device.
Battery Status API
Provides information about the battery's charge level and whether or not the device is currently plugged in and charging.
Geolocation API
Provides information about the device's physical location.
Pointer Lock API
Lets apps lock access to the mouse and gain access to movement deltas rather than absolute coordinates; this is great for gaming.
Power Management API {{PrivilegedBadge}}
Lets apps turn on and off the screen, CPU, device power, and so forth. Also provides support for listening for and inspecting resource lock events.
Proximity API
Lets you detect proximity of the device to a nearby object, such as the user's face.
Screen Orientation API
Provides notifications when the screen's orientation changes. You can also use this API to let your app indicate what orientation it prefers.
Vibration API
Lets apps control the device's vibration hardware for things such as haptic feedback in games. This is not intended for things such as notification vibrations. See the Alarm API for that.
WebFM API
Provides support for a device's FM radio functionality, if available.

Other APIs

Alarm API
Lets apps schedule notifications. Also provides support for automatically launching an app at a specific time.
Apps API
The Open WebApps API provides support for installing and managing Web apps. In addition, support is provided to let apps determine payment information.
Browser API
Provides support for building a Web browser completely using Web technologies (in essence, a browser within a browser). Page needs moving.
Idle API {{PrivilegedBadge}}
Lets apps receive notifications when the user is not actively using the device.
Permissions API {{PrivilegedBadge}}
Manages app permissions in a centralized location. Used by the Settings app.
Push Notifications API
Lets the platform send notification messages to specific applications.
Time/Clock API
Provides support for setting the current time. The time zone is set using the Settings API.
Web Activities
Lets an app delegate an activity to another app. Need more here.
WebPayment API
Lets Web content initiate payments and refunds for virtual goods.

WebAPI community

If you need help with these APIs, there are several ways you can talk to other developers making use of them.

  • Consult the WebAPI forum: {{DiscussionList("dev-webapi", "mozilla.dev.webapi")}}
  • Visit the WebAPI IRC channel: #webapi

Don't forget about the netiquette...

??

Nothing here yet.

 

 

Documentation about WebAPI

APIs implemented and drafted in a W3C specification

{{domxref("window.navigator.mozAlarms", "Alarm API")}}
Allow to schedule alarm able to wake up the system. There is a draft documentation available.
Ambient Light Events
Provides events when the light level change: {{domxref("DeviceLightEvent")}} {{domxref("LightLevelEvent")}}
{{domxref("window.navigator.battery", "Battery API")}}
Provides information about the system's battery charge level.
{{domxref("window.navigator.connection", "Network information API")}}
Provides information about the system's connection, such as the current bandwidth.
{{domxref("window.navigator.vibrate", "Vibration API")}}
Pulses the vibration hardware on the device.

Implemented but not yet standardized APIs

WebSMS {{avail_inline("Only available to certified apps on B2G")}}
WebSMS is an API that makes it possible for web content to create, send, and receive Short Message Service (SMS) text messages.
WebTelephony {{avail_inline("Only available to certified apps on B2G")}}
WebTelephony is an API that makes it possible for web content to handle voice phone calls from JavaScript code.
{{domxref("window.navigator.mozCameras","Camera API")}} {{avail_inline("Only available to certified apps on B2G")}}
Camera is an API that make possible for applications to gain a direct access to the cameras available on a device.
{{domxref("window.navigator.mozCameras","Power Management API")}} {{avail_inline("Only available to certified apps on B2G")}}
The power management API is used to take axplicite control ocver the part of the device that use power.
{{domxref("window.navigator.mozSettings","Settings API")}} {{avail_inline("Only available to certified apps on B2G")}}
The settings API allows to access and change settings of a given device.

View All...

Getting help from the community

Mailing lists, IRC channels, ...

  • Consult the dedicated Mozilla forum : {{ DiscussionList("dev-webapi", "mozilla.dev.webapi") }}
  • #webapi on irc.mozilla.org
  • WebAPI project page on wikimo

Don't forget about the netiquette...

 

Revision Source

<p><strong>WebAPI</strong> is a term used to refer to a suite of device compatibility and access APIs that allow Web apps and content to access device hardware (such as battery status or the device vibration hardware), as well as access to data stored on the device (such as the calendar or contacts list). By adding these APIs, we hope to expand what the Web can do today and only proprietary platforms were able to do in the past.</p>
<div class="note">
  <p><strong>Note:</strong> More of this documentation has been written than it looks like; links are not all added yet. We're actively working on improving this and expect to see things much better by around April 5.</p>
</div>
<div class="note">
  <p><strong>Note:</strong> Please excuse our dust; we're in the process of totally revamping this page. It should be finished by the end of day Monday 1 April. Thank you for your patience!</p>
</div>
<div class="row topicpage-table">
  <div class="section">
    <h2 class="Documentation" id="Documentation" name="Documentation">Communication APIs</h2>
    <dl>
      <dt>
        <a href="/en-US/docs/WebAPI/WebBluetooth" title="/en-US/docs/WebAPI/WebBluetooth">Bluetooth</a> {{PrivilegedBadge}}</dt>
      <dd>
        The WebBluetooth API provides low-level access to the device's Bluetooth hardware.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Mobile_Connection" title="/en-US/docs/WebAPI/Mobile_Connection">Mobile Connection API</a> {{PrivilegedBadge}}</dt>
      <dd>
        Exposes information about the device's cellular connectivity, such as signal strength, operator information, and so forth.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Network_Information" title="/en-US/docs/WebAPI/Network_Information">Network Information API</a></dt>
      <dd>
        Provides basic information about the current network connection, such as connection speed.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Network_Stats" title="/en-US/docs/WebAPI/Network_Stats">Network Stats API</a> {{PrivilegedBadge}}</dt>
      <dd>
        Monitors data usage and exposes this data to privileged applications.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/TCP_Socket" title="/en-US/docs/WebAPI/TCP_Socket">TCP Socket API</a></dt>
      <dd>
        Provides low-level sockets and SSL support.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/WebTelephony" title="/en-US/docs/WebAPI/WebTelephony">Telephony</a></dt>
      <dd>
        Lets apps place and answer phone calls and use the built-in telephony user interface. There's a temporary page about this here: <a href="/en-US/docs/API/WebTelephony/Introduction_to_WebTelephony" title="/en-US/docs/API/WebTelephony/Introduction_to_WebTelephony">WebTelephony</a>.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/WebSMS" title="/en-US/docs/WebAPI/WebSMS">WebSMS </a>{{PrivilegedBadge}}</dt>
      <dd>
        Lets apps send and receive SMS text messages, as well as to access and manage the messages stored on the device.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/WiFi_Information" title="/en-US/docs/WebAPI/WiFi_Information">WiFi Information API</a> {{PrivilegedBadge}}</dt>
      <dd>
        A privileged API which provides information about signal strength, the name of the current network, available WiFi networks, and so forth.</dd>
    </dl>
    <h2 class="Documentation" id="Documentation" name="Documentation">Data management APIs</h2>
    <dl>
      <dt>
        <a href="/en-US/docs/WebAPI/Archive" title="/en-US/docs/WebAPI/Archive">Archive API</a></dt>
      <dd>
        Support for accessing the contents of {{interwiki("wikipedia", "Zip")}} file archives in {{domxref("Blob")}} objects.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Contacts" title="/en-US/docs/WebAPI/Contacts">Contacts API</a></dt>
      <dd>
        Provides access to the user's contacts database, with support for adding, reading, and modifying contact information.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Device_Storage_API" title="/en-US/docs/WebAPI/Device_Storage_API">Device Storage API</a></dt>
      <dd>
        Allows apps to create, read, and change files stored in a central location on the device, such as the "pictures" folder on modern desktop platforms or the photo storage on mobile devices. <strong>Page needs to move.</strong></dd>
      <dt>
        <a href="/en-US/docs/WebAPI/FileHandle_API" title="/en-US/docs/WebAPI/FileHandle_API">FileHandle API</a></dt>
      <dd>
        Provides support for writable files with locking support. <strong>Page needs moving.</strong></dd>
      <dt>
        <a href="/en-US/docs/IndexedDB" title="/en-US/docs/IndexedDB">IndexedDB</a></dt>
      <dd>
        Client-side storage of structured data with support for high-performance searches. <strong>Docs need moving.</strong></dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Settings" title="/en-US/docs/WebAPI/Settings">Settings API</a> {{PrivilegedBadge}}</dt>
      <dd>
        Lets apps examine and change system-wide configuration options that are permanently stored on the device.</dd>
    </dl>
    <p><span class="alllinks"><a href="/en-US/docs/tag/WebAPI" title="/en-US/docs/tag/CSS">View All...</a></span></p>
  </div>
  <div class="section">
    <h2 class="Documentation" id="Documentation" name="Documentation">Hardware access APIs</h2>
    <dl>
      <dt>
        <a href="/en-US/docs/WebAPI/Ambient_Light" title="/en-US/docs/WebAPI/Ambient_Light">Ambient Light Sensor API</a></dt>
      <dd>
        Provides access to the ambient light sensor, which lets your app detect the ambient light level in the vicinity of the device.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Battery_Status" title="/en-US/docs/WebAPI/Battery_Status">Battery Status API</a></dt>
      <dd>
        Provides information about the battery's charge level and whether or not the device is currently plugged in and charging.</dd>
      <dt>
        <a href="/en-US/docs/Using_geolocation" title="/en-US/docs/Using_geolocation">Geolocation API</a></dt>
      <dd>
        Provides information about the device's physical location.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Pointer_Lock" title="/en-US/docs/API/Pointer_Lock_API">Pointer Lock API</a></dt>
      <dd>
        Lets apps lock access to the mouse and gain access to movement deltas rather than absolute coordinates; this is great for gaming.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Power_Management" title="/en-US/docs/WebAPI/Power_Management">Power Management API </a>{{PrivilegedBadge}}</dt>
      <dd>
        Lets apps turn on and off the screen, CPU, device power, and so forth. Also provides support for listening for and inspecting resource lock events.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Proximity" title="/en-US/docs/WebAPI/Proximity">Proximity API</a></dt>
      <dd>
        Lets you detect proximity of the device to a nearby object, such as the user's face.</dd>
      <dt>
        <a href="/en-US/docs/Detecting_device_orientation" title="/en-US/docs/Detecting_device_orientation">Screen Orientation API</a></dt>
      <dd>
        Provides notifications when the screen's orientation changes. You can also use this API to let your app indicate what orientation it prefers.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Vibration" title="/en-US/docs/WebAPI/WebBluetooth">Vibration API</a></dt>
      <dd>
        Lets apps control the device's vibration hardware for things such as haptic feedback in games. This is <strong>not</strong> intended for things such as notification vibrations. See the <a href="/en-US/docs/WebAPI/Alarm" title="/en-US/docs/WebAPI/Alarm">Alarm API</a> for that.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/WebFM_API" title="/en-US/docs/WebAPI/WebFM_API">WebFM API</a></dt>
      <dd>
        Provides support for a device's FM radio functionality, if available.</dd>
    </dl>
    <h2 class="Documentation" id="Documentation" name="Documentation">Other APIs</h2>
    <dl>
      <dt>
        <a href="/en-US/docs/WebAPI/Alarm" title="/en-US/docs/WebAPI/Alarm">Alarm API</a></dt>
      <dd>
        Lets apps schedule notifications. Also provides support for automatically launching an app at a specific time.</dd>
      <dt>
        <a href="/en-US/docs/Apps" title="/en-US/docs/Apps">Apps API</a></dt>
      <dd>
        The Open WebApps API provides support for installing and managing Web apps. In addition, support is provided to let apps determine payment information.</dd>
      <dt>
        <a href="/en-US/docs/DOM/Using_the_Browser_API" title="/en-US/docs/DOM/Using_the_Browser_API"><strong>Browser API</strong></a></dt>
      <dd>
        Provides support for building a Web browser completely using Web technologies (in essence, a browser within a browser). <strong>Page needs moving.</strong></dd>
    </dl>
    <dl>
      <dt>
        <a href="/en-US/docs/WebAPI/Idle" title="/en-US/docs/WebAPI/Device_Storage_API">Idle API</a> {{PrivilegedBadge}}</dt>
      <dd>
        Lets apps receive notifications when the user is not actively using the device.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Permissions" title="/en-US/docs/WebAPI/Permissions">Permissions API</a> {{PrivilegedBadge}}</dt>
      <dd>
        Manages app permissions in a centralized location. Used by the Settings app.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Push_Notifications" title="/en-US/docs/WebAPI/Push_Notifications">Push Notifications API</a></dt>
      <dd>
        Lets the platform send notification messages to specific applications.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Time_and_Clock" title="/en-US/docs/WebAPI/Time_and_Clock">Time/Clock API</a></dt>
      <dd>
        Provides support for setting the current time. The time zone is set using the <a href="/en-US/docs/WebAPI/Settings" title="/en-US/docs/WebAPI/Settings">Settings API</a>.</dd>
      <dt>
        <a href="/en-US/docs/WebAPI/Web_Activities" title="/en-US/docs/WebAPI/Web_Activities">Web Activities</a></dt>
      <dd>
        Lets an app delegate an activity to another app. <strong>Need more here.</strong></dd>
      <dt>
        <a href="/en-US/docs/WebAPI/WebPayment_API" title="/en-US/docs/WebAPI/WebPayment_API">WebPayment API</a></dt>
      <dd>
        Lets Web content initiate payments and refunds for virtual goods.</dd>
    </dl>
    <h2 class="Community" id="Community" name="Community">WebAPI community</h2>
    <p>If you need help with these APIs, there are several ways you can talk to other developers making use of them.</p>
    <ul>
      <li>Consult the WebAPI forum: {{DiscussionList("dev-webapi", "mozilla.dev.webapi")}}</li>
      <li>Visit the WebAPI IRC channel: <a href="irc://irc.mozilla.org/webapi" title="irc://irc.mozilla.org/webapi">#webapi</a></li>
    </ul>
    <p><span class="alllinks"><a class="external" href="http://www.catb.org/~esr/faqs/smart-questions.html" title="http://www.catb.org/~esr/faqs/smart-questions.html">Don't forget about the <em>netiquette</em>...</a></span></p>
    <h2 class="Tools" id="Tools" name="Tools">??</h2>
    <p>Nothing here yet.</p>
  </div>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table class="topicpage-table">
  <tbody>
    <tr>
      <td colspan="2">
        <h2 class="Documentation" id="Documentation" name="Documentation">Documentation about WebAPI</h2>
      </td>
    </tr>
    <tr>
      <td>
        <h3 id="APIs_implemented_and_drafted_in_a_W3C_specification">APIs implemented and drafted in a W3C specification</h3>
        <dl>
          <dt>
            {{domxref("window.navigator.mozAlarms", "Alarm API")}}</dt>
          <dd>
            Allow to schedule alarm able to wake up the system. <a href="/en-US/docs/API/Alarm_API" title="/en-US/docs/API/Alarm_API">There is a draft documentation available</a>.</dd>
          <dt>
            Ambient Light Events</dt>
          <dd>
            Provides events when the light level change: {{domxref("DeviceLightEvent")}} {{domxref("LightLevelEvent")}}</dd>
          <dt>
            {{domxref("window.navigator.battery", "Battery API")}}</dt>
          <dd>
            Provides information about the system's battery charge level.</dd>
          <dt>
            {{domxref("window.navigator.connection", "Network information API")}}</dt>
          <dd>
            Provides information about the system's connection, such as the current bandwidth.</dd>
          <dt>
            {{domxref("window.navigator.vibrate", "Vibration API")}}</dt>
          <dd>
            Pulses the vibration hardware on the device.</dd>
        </dl>
      </td>
      <td>
        <h3 id="Implemented_but_not_yet_standardized_APIs">Implemented but not yet standardized APIs</h3>
        <dl>
          <dt>
            <a href="/en-US/docs/API/WebSMS">WebSMS</a> {{avail_inline("Only available to certified apps on B2G")}}</dt>
          <dd>
            WebSMS is an API that makes it possible for web content to create, send, and receive Short Message Service (SMS) text messages.</dd>
          <dt>
            <a href="/en-US/docs/API/WebTelephony">WebTelephony</a> {{avail_inline("Only available to certified apps on B2G")}}</dt>
          <dd>
            WebTelephony is an API that makes it possible for web content to handle voice phone calls from JavaScript code.</dd>
          <dt>
            {{domxref("window.navigator.mozCameras","Camera API")}} {{avail_inline("Only available to certified apps on B2G")}}</dt>
          <dd>
            Camera is an API that make possible for applications to gain a direct access to the cameras available on a device.</dd>
          <dt>
            {{domxref("window.navigator.mozCameras","Power Management API")}} {{avail_inline("Only available to certified apps on B2G")}}</dt>
          <dd>
            The power management API is used to take axplicite control ocver the part of the device that use power.</dd>
          <dt>
            {{domxref("window.navigator.mozSettings","Settings API")}} {{avail_inline("Only available to certified apps on B2G")}}</dt>
          <dd>
            The settings API allows to access and change settings of a given device.</dd>
        </dl>
        <p><span class="alllinks"><a href="/en-US/docs/tag/WebAPI" title="Article tagged: WebAPI">View All...</a></span></p>
      </td>
    </tr>
    <tr>
      <td>
        <h2 class="Related_Topics" id="Related_Topics" name="Related_Topics">Related Topics</h2>
        <ul>
          <li>The <a href="/en-US/docs/Document_Object_Model_(DOM)" title="Document Object Model (DOM)">Document Object Model (DOM)</a> is the representation of an HTML document as a tree.</li>
          <li><a href="/en-US/docs/JavaScript" title="/en-US/docs/JavaScript">JavaScript</a> - Scripting language for the Web.</li>
          <li><a href="/en-US/docs/WebAPI/Doc_status" title="/en-US/docs/WebAPI/Doc_status">Doc status</a>: A list of WebAPI topics and their documentation status.</li>
        </ul>
      </td>
      <td>
        <h2 class="Community" id="Community" name="Community">Getting help from the community</h2>
        <p>Mailing lists, IRC channels, ...</p>
        <ul>
          <li>Consult the dedicated Mozilla forum : {{ DiscussionList("dev-webapi", "mozilla.dev.webapi") }}</li>
          <li>#webapi on irc.mozilla.org</li>
          <li><a href="https://wiki.mozilla.org/WebAPI" title="https://wiki.mozilla.org/WebAPI">WebAPI project page on wikimo</a></li>
        </ul>
        <p><span class="alllinks"><a class="external" href="http://www.catb.org/~esr/faqs/smart-questions.html" title="http://www.catb.org/~esr/faqs/smart-questions.html">Don't forget about the <em>netiquette</em>...</a></span></p>
      </td>
    </tr>
  </tbody>
</table>
<p>&nbsp;</p>
Revert to this revision