Headers.keys() method returns an iterator allowing to go through all keys contained in this object. The keys are ByteString 对象。

注意 : This method is available in Web 工作者 .

句法

headers.keys();
					

返回值

返回 iterator .

范例

// Create a test Headers object
var myHeaders = new Headers();
myHeaders.append('Content-Type', 'text/xml');
myHeaders.append('Vary', 'Accept-Language');
// Display the keys
for(var key of myHeaders.keys()) {
   console.log(key);
}
					

The result is:

content-type
vary
					

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
keys Chrome 45 Edge 16 Firefox 44 IE 不支持 No Opera 32 Safari ? WebView Android 45 Chrome Android 45 Firefox Android 44 Opera Android 32 Safari iOS 不支持 No Samsung Internet Android 5.0

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

另请参阅

元数据

  • 最后修改: