Headers.values()

您正在阅读此内容的英文版本,因为该语系尚未翻译。 帮助我们翻译此文章吧!

Headers.values()方法返回一个可迭代数值,通过这个数值可以遍历Headers中键值对的value值。返回的value都是ByteString对象。

注意: 这个方法可以在 Web Workers中使用。

语法

headers.values();

返回值

返回一个由键值对中value组成的数组。

例子

// Create a test Headers object
var myHeaders = new Headers();
myHeaders.append('Content-Type', 'text/xml');
myHeaders.append('Vary', 'Accept-Language');

// Display the values
for (var value of myHeaders.values()) {
   console.log(value); 
}

返回值为:

text/xml
Accept-Language

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
values
Experimental
Chrome Full support 45Edge Full support 16Firefox Full support 44IE No support NoOpera Full support 32Safari ? WebView Android Full support 45Chrome Android Full support 45Firefox Android Full support 44Opera Android Full support 32Safari iOS No support NoSamsung Internet Android Full support 5.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also