From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/headers/entries/index.html | 117 +++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 files/zh-cn/web/api/headers/entries/index.html (limited to 'files/zh-cn/web/api/headers/entries') diff --git a/files/zh-cn/web/api/headers/entries/index.html b/files/zh-cn/web/api/headers/entries/index.html new file mode 100644 index 0000000000..abcc44ce61 --- /dev/null +++ b/files/zh-cn/web/api/headers/entries/index.html @@ -0,0 +1,117 @@ +--- +title: Headers.entries() +slug: Web/API/Headers/entries +translation_of: Web/API/Headers/entries +--- +

{{APIRef}}{{SeeCompatTable}}

+ +

Headers.entries() 以 {{jsxref("Iteration_protocols","迭代器")}} 的形式返回Headers对象中所有的键值对. 

+ +
+

Note: 这个方法在 Web Workers中是可用的.

+
+ +

Syntax

+ +
headers.entries();
+ +

Return value

+ +

返回一个 {{jsxref("Iteration_protocols","迭代器")}}.

+ +

Example

+ +
// Create a test Headers object
+var myHeaders = new Headers();
+myHeaders.append('Content-Type', 'text/xml');
+myHeaders.append('Vary', 'Accept-Language');
+
+// Display the key/value pairs
+for (var pair of myHeaders.entries()) {
+   console.log(pair[0]+ ': '+ pair[1]);
+}
+
+ +

返回结果:

+ +
content-type: text/xml
+vary: Accept-Language
+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Fetch','#headers-class','Headers.entries() (as iterator<>)')}}{{Spec2('Fetch')}}Initial definition.
+ +

Browser compatibility

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatUnknown}}{{CompatGeckoDesktop(44)}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)Firefox OS (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}{{CompatUnknown}}{{CompatGeckoMobile(44)}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

See also

+ + -- cgit v1.2.3-54-g00ecf