DOM:window.btoa
From MDC
Contents |
[edit] Summary
Creates a base-64 encoded ASCII string from a string of binary data.
[edit] Syntax
var encodedData = window.btoa(stringToEncode);
[edit] Example
var encodedData = window.btoa("Hello, world"); // encode a string
var decodedData = atob(encodedData); // decode the string
[edit] Notes
You can use this method to encode data which may otherwise cause communication problems, transmit it, then use the window.atob method to decode the data again. For example, you can encode control characters such as ASCII values 0 through 31.
btoa() 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.