WebSMS

  • Revision slug: WebAPI/WebSMS
  • Revision title: WebSMS
  • Revision id: 372741
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment Moved From API/WebSMS to WebAPI/WebSMS

Revision Content

WebSMS is an API that makes it possible for web content to create, send, and receive Short Message Service (SMS) text messages.

The API is available using {{ domxref("window.navigator.mozSms") }} which returns a {{ domxref("SmsManager") }} object. See below for a full list of interfaces:

DOM interfaces

  • {{ domxref("window.navigator.mozSms") }}
  • {{ domxref("SmsManager") }}
  • {{ domxref("SmsRequest") }}
  • {{ domxref("SmsMessage") }}
  • {{ domxref("SmsEvent") }}
  • {{ domxref("SmsFilter") }}
  • {{ domxref("SmsCursor") }}

Interfaces

  • {{ interface("nsISmsDatabaseService") }}
  • {{ interface("nsISmsRequestManager") }}
  • {{ interface("nsISmsService") }}

Sample code and introduction

Browser compatibility

For obvious reasons, support is primarily expected on mobile browsers.

Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatNo() }} {{ CompatGeckoMobile("12.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}

 

Preferences & availability

  • WebSMS is disabled by default and can be enabled setting the preference dom.sms.enabled to true.
  • A comma-separated whitelist of allowed hostnames that are allowed to use the WebSMS API must be specified using the dom.sms.whitelist preference. This string is empty by default.
  • WebSMS is only available to certified apps on Firefox OS (B2G).

See also

Revision Source

<p>WebSMS is an API that makes it possible for web content to create, send, and receive Short Message Service (SMS) text messages.</p>
<p>The API is available using {{ domxref("window.navigator.mozSms") }} which returns a {{ domxref("SmsManager") }} object. See below for a full list of interfaces:</p>
<h2 id="DOM_interfaces">DOM interfaces</h2>
<ul>
  <li>{{ domxref("window.navigator.mozSms") }}</li>
  <li>{{ domxref("SmsManager") }}</li>
  <li>{{ domxref("SmsRequest") }}</li>
  <li>{{ domxref("SmsMessage") }}</li>
  <li>{{ domxref("SmsEvent") }}</li>
  <li>{{ domxref("SmsFilter") }}</li>
  <li>{{ domxref("SmsCursor") }}</li>
</ul>
<h2 id="Interfaces">Interfaces</h2>
<ul>
  <li>{{ interface("nsISmsDatabaseService") }}</li>
  <li>{{ interface("nsISmsRequestManager") }}</li>
  <li>{{ interface("nsISmsService") }}</li>
</ul>
<h2 id="Sample_code_and_introduction">Sample code and introduction</h2>
<ul>
  <li><a href="/en/API/WebSMS/Introduction_to_WebSMS" title="en/API/WebSMS/Introduction_to_WebSMS">Introduction to WebSMS</a></li>
</ul>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>For obvious reasons, support is primarily expected on mobile browsers.</p>
<table class="compat-table">
  <tbody>
    <tr>
      <th>Feature</th>
      <th>Android</th>
      <th>Firefox Mobile (Gecko)</th>
      <th>IE Mobile</th>
      <th>Opera Mobile</th>
      <th>Safari Mobile</th>
    </tr>
    <tr>
      <td>Basic support</td>
      <td>{{ CompatNo() }}</td>
      <td>{{ CompatGeckoMobile("12.0") }}</td>
      <td>{{ CompatNo() }}</td>
      <td>{{ CompatNo() }}</td>
      <td>{{ CompatNo() }}</td>
    </tr>
  </tbody>
</table>
<p>&nbsp;</p>
<h2 id="Preferences_.26_availability">Preferences &amp; availability</h2>
<ul>
  <li>WebSMS is disabled by default and can be enabled setting the preference <code>dom.sms.enabled</code> to true.</li>
  <li>A comma-separated whitelist of allowed hostnames that are allowed to use the WebSMS API must be specified using the <code>dom.sms.whitelist</code> preference. This string is empty by default.</li>
  <li>WebSMS is only available to certified apps on Firefox OS (B2G).</li>
</ul>
<h2 class="note" id="See_also">See also</h2>
<ul>
  <li><a class="link-https" href="https://wiki.mozilla.org/WebAPI/WebSMS" title="https://wiki.mozilla.org/WebAPI/WebSMS">WebSMS API</a> (design document)</li>
</ul>
Revert to this revision