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 674763 of WindowBase64

  • Revision slug: Web/API/WindowBase64
  • Revision title: WindowBase64
  • Revision id: 674763
  • Created:
  • Creator: mikeizworkin
  • Is current revision? No
  • Comment

Revision Content

{{APIRef}}

The WindowBase64 interface contains utility methods to convert data to and from base64, a binary-to-text encoding scheme. For example it is used in data URIs. There is no object of this type, though the context object, either the {{domxref("Window")}} for regular browsing scope, or the {{domxref("WorkerGlobalScope")}}  for workers, implements it.

Properties

This interface neither defines nor inherits any properties.

Methods

This interface does not inherit any methods.

{{domxref("WindowBase64.atob()")}}
Decodes a string of data which has been encoded using base-64 encoding.
{{domxref("WindowBase64.btoa()")}}
Creates a base-64 encoded ASCII string from a string of binary data.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', '#windowbase64', 'WindowBase64')}} {{Spec2('HTML WHATWG')}} No change since the latest snapshot, {{SpecName("HTML5.1")}}.
{{SpecName('HTML5.1', '#windowbase64', 'WindowBase64')}} {{Spec2('HTML5.1')}} Snapshot of {{SpecName("HTML WHATWG")}}. No change.
{{SpecName("HTML5 W3C", "#windowbase64", "WindowBase64")}} {{Spec2('HTML5 W3C')}} Snapshot of {{SpecName("HTML WHATWG")}}. Creation of WindowBase64 (properties where on the target before it).

Browser compatibility

{{CompatibilityTable}}

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support {{CompatGeckoDesktop(1)}} [1] {{CompatVersionUnknown}} 10.0 {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Feature Firefox Mobile (Gecko) Android IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatGeckoMobile(1)}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

[1]  atob() is also available to XPCOM components implemented in JavaScript, even though {{domxref("Window")}} is not the global object in components.

See also

  • Base64 encoding and decoding
  • {{domxref("Window")}}, {{domxref("WorkerGlobalScope")}}, {{domxref("DedicatedWorkerGlobalScope")}}, {{domxref("SharedWorkerGlobalScope")}}, and {{domxref("ServiceWorkerGlobalScope")}}

Revision Source

<p>{{APIRef}}</p>
<p>The <code><strong>WindowBase64</strong></code> interface contains utility methods to convert data to and from base64, a binary-to-text encoding scheme. For example it is used in <a href="/en-US/docs/data_URIs">data URIs</a>. There is no object of this type, though the context object, either the {{domxref("Window")}} for regular browsing scope, or the {{domxref("WorkerGlobalScope")}}&nbsp; for workers, implements it.</p>
<h2 id="Properties">Properties</h2>
<p><em>This interface neither defines nor inherits any properties.</em></p>
<h2 id="Methods">Methods</h2>
<p><em>This interface does not inherit any methods.</em></p>
<dl>
 <dt>
  {{domxref("WindowBase64.atob()")}}</dt>
 <dd>
  Decodes a string of data which has been encoded using base-64 encoding.</dd>
 <dt>
  {{domxref("WindowBase64.btoa()")}}</dt>
 <dd>
  Creates a base-64 encoded ASCII string from a string of binary data.</dd>
</dl>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', '#windowbase64', 'WindowBase64')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>No change since the latest snapshot, {{SpecName("HTML5.1")}}.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5.1', '#windowbase64', 'WindowBase64')}}</td>
   <td>{{Spec2('HTML5.1')}}</td>
   <td>Snapshot of {{SpecName("HTML WHATWG")}}. No change.</td>
  </tr>
  <tr>
   <td>{{SpecName("HTML5 W3C", "#windowbase64", "WindowBase64")}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>Snapshot of {{SpecName("HTML WHATWG")}}. Creation of <code>WindowBase64</code> (properties where on the target before it).</td>
  </tr>
 </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Firefox (Gecko)</th>
    <th>Chrome</th>
    <th>Internet Explorer</th>
    <th>Opera</th>
    <th>Safari</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatGeckoDesktop(1)}} [1]</td>
    <td>{{CompatVersionUnknown}}</td>
    <td>10.0</td>
    <td>{{CompatVersionUnknown}}</td>
    <td>{{CompatVersionUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<div id="compat-mobile">
 <table class="compat-table">
  <tbody>
   <tr>
    <th>Feature</th>
    <th>Firefox Mobile (Gecko)</th>
    <th>Android</th>
    <th>IE Mobile</th>
    <th>Opera Mobile</th>
    <th>Safari Mobile</th>
   </tr>
   <tr>
    <td>Basic support</td>
    <td>{{CompatGeckoMobile(1)}}</td>
    <td rowspan="1">{{CompatVersionUnknown}}</td>
    <td rowspan="1">{{CompatVersionUnknown}}</td>
    <td rowspan="1">{{CompatVersionUnknown}}</td>
    <td rowspan="1">{{CompatVersionUnknown}}</td>
   </tr>
  </tbody>
 </table>
</div>
<p>[1]&nbsp; <code>atob()</code> is also available to XPCOM components implemented in JavaScript, even though {{domxref("Window")}} is not the global object in components.</p>
<h2 id="See_also">See also</h2>
<ul>
 <li><a href="/Web/API/WindowBase64/Base64_encoding_and_decoding">Base64 encoding and decoding</a></li>
 <li>{{domxref("Window")}}, {{domxref("WorkerGlobalScope")}}, {{domxref("DedicatedWorkerGlobalScope")}}, {{domxref("SharedWorkerGlobalScope")}}, and {{domxref("ServiceWorkerGlobalScope")}}</li>
</ul>
Revert to this revision