Visit Mozilla.org

DOM:window.atob

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

Decodes a string of data which has been encoded using base-64 encoding.

[edit] Syntax

var decodedData = window.atob(encodedData);

[edit] Example

var encodedData = window.btoa("Hello, world"); // encode a string
var decodedData = window.atob(encodedData); // decode the string

[edit] Notes

You can use the window.btoa() method to encode and transmit data which may otherwise cause communication problems, then transmit it and use the window.atob() method to decode the data again. For example, you can encode, transmit, and decode control characters such as ASCII values 0 through 31.

atob() is also available to XPCOM components implemented in JavaScript, even though window is not the global object in components.

[edit] Specification

DOM Level 0. Not part of any standard.

[edit] See also

btoa