Window.atob()

  • Revision slug: DOM/window.atob
  • Revision title: window.atob
  • Revision id: 19228
  • Created:
  • Creator: Celelibi
  • Is current revision? No
  • Comment

Revision Content

{{template.DomRef()}}

Summary

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

Syntax

atob(encodedData)

Example

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

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 characters such as ASCII values 0 through 31.

Specification

{{template.DOM0()}}

See also

btoa

{{ wiki.languages( { "fr": "fr/DOM/window.btoa" } ) }}

Revision Source

<p>
{{template.DomRef()}}
</p>
<h3 name="Summary"> Summary </h3>
<p>Decodes a string of data which has been encoded using base-64 encoding. 
</p>
<h3 name="Syntax"> Syntax </h3>
<pre class="eval">atob(<i>encodedData</i>)
</pre>
<h3 name="Example"> Example </h3>
<pre class="eval">encodedData = btoa("Hello, world"); // encode a string
decodedData = atob(encodedData); // decode the string
</pre>
<h3 name="Notes"> Notes </h3>
<p>You can use the <a href="en/DOM/window.btoa">window.btoa</a> method to encode and transmit data which may otherwise cause communication problems, then transmit it and use the <code>window.atob</code> method to decode the data again. For example, you can encode, transmit, and decode characters such as ASCII values 0 through 31.
</p>
<h3 name="Specification"> Specification </h3>
<p>{{template.DOM0()}}
</p>
<h3 name="See_also"> See also </h3>
<p><a href="en/DOM/window.btoa">btoa</a>
</p>{{ wiki.languages( { "fr": "fr/DOM/window.btoa" } ) }}
Revert to this revision