{{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 do not define any property, nor inherit any.
Methods
This interface do not inherit any method.
- {{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")}}