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.

searchParamsURL インターフェイスの読み取り専用プロパティで、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 GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
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.