URL: searchParams プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
searchParams
は URL
インターフェイスの読み取り専用プロパティで、URL に含まれる GET
デコードされたクエリー引数へのアクセスを可能にする URLSearchParams
オブジェクトを返します。
メモ: この機能はウェブワーカー内で利用可能です。
値
URLSearchParams
オブジェクト。
例
ページの URL が https://example.com/?name=Jonathan%20Smith&age=18
である場合、次を使用して name
および age
引数を解釈できます。
js
let params = new URL(document.location).searchParams;
let name = params.get("name"); // 文字列 "Jonathan Smith" です。
let age = parseInt(params.get("age")); // 数値 18 です。
仕様書
Specification |
---|
URL # dom-url-searchparams |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
searchParams |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- Has more compatibility info.
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.