has()
方法在
URLSearchParams
interface returns a
布尔
that indicates whether a parameter with the specified name exists.
var hasName = URLSearchParams.has(name)
The name of the parameter to find.
A
布尔
.
let url = new URL('https://example.com?foo=1&bar=2');
let params = new URLSearchParams(url.search.slice(1));
params.has('bar') === true; //true
| 规范 | 状态 | 注释 |
|---|---|---|
|
URL
The definition of 'has()' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
has
|
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