getAll()
方法在
URLSearchParams
interface returns all the values associated with a given search parameter as an array.
URLSearchParams.getAll(name)
The name of the parameter to return.
An array of
USVString
。
let url = new URL('https://example.com?foo=1&bar=2');
let params = new URLSearchParams(url.search.slice(1));
//Add a second foo parameter.
params.append('foo', 4);
console.log(params.getAll('foo')) //Prints ["1","4"].
| 规范 | 状态 | 注释 |
|---|---|---|
|
URL
The definition of 'getAll()' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getAll
|
Chrome 49 | Edge 17 | Firefox 29 | IE 不支持 No | Opera 36 | Safari Yes | WebView Android 49 | Chrome Android 49 | Firefox Android 29 | Opera Android 36 | Safari iOS Yes | Samsung Internet Android 5.0 |
完整支持
不支持
URLSearchParams