Headers: keys() メソッド
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
メモ: この機能はウェブワーカー内で利用可能です。
Headers.keys()
メソッドは、このオブジェクトに含まれるすべてのキーを読み取ることができるイテレーターオブジェクトを返します。キーは文字列です。です。
構文
js
keys()
引数
なし。
返値
イテレーターを返します。
例
js
// テスト用の Headers オブジェクトを作成
const myHeaders = new Headers();
myHeaders.append("Content-Type", "text/xml");
myHeaders.append("Vary", "Accept-Language");
// キーを表示
for (const key of myHeaders.keys()) {
console.log(key);
}
結果は次の通りです。
content-type vary
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keys |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.