1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
---
title: WindowBase64
slug: Web/API/WindowBase64
translation_of: Web/API/WindowOrWorkerGlobalScope
translation_of_original: Web/API/WindowBase64
---
<p>{{APIRef("HTML DOM")}}</p>
<p>The <code><strong>WindowBase64</strong></code> helper 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>.</p>
<p>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.</p>
<h2 id="屬性">屬性</h2>
<p><em>This helper neither defines nor inherits any properties.</em></p>
<h2 id="方法">方法</h2>
<p><em>This helper 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="規範">規範</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="瀏覽器相容性">瀏覽器相容性</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] <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="參見">參見</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>
|