keys()
方法在
URLSearchParams
interface returns an
iterator
allowing iteration through all keys contained in this object. The keys are
USVString
对象。
注意 : This method is available in Web 工作者 .
searchParams.keys();
None.
返回
iterator
.
// Create a test URLSearchParams object
var searchParams = new URLSearchParams("key1=value1&key2=value2");
// Display the keys
for(var key of searchParams.keys()) {
console.log(key);
}
The result is:
key1 key2
| 规范 | 状态 | 注释 |
|---|---|---|
|
URL
The definition of 'keys() (see "iterable")' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
keys
|
Chrome 49 | Edge 17 | Firefox 44 | IE 不支持 No | Opera 36 | Safari Yes | WebView Android 49 | Chrome Android 49 | Firefox Android 44 | Opera Android 36 | Safari iOS Yes | Samsung Internet Android 5.0 |
完整支持
不支持
URL
接口。
URLSearchParams