ウィンドウlocation.search
例
URLのクエリ文字列部分を返します。
let query = location.search;
定義と使用法
search
プロパティは、疑問符(?)を含むURLのクエリ文字列部分を返します。
このsearch
プロパティを使用して、クエリ文字列を設定することもできます。
ノート
クエリ文字列の部分は、疑問符(?)の後のURLの部分です。
クエリ文字列は、パラメータの受け渡しに使用されます。
構文
検索プロパティを返します。
location.search
検索プロパティを設定します。
location.search = querystring
プロパティ値
Parameter | Description |
querystring | The querystring part of the URL |
戻り値
タイプ | 説明 |
文字列 | 疑問符(?)を含むURLのクエリ文字列部分 |
ブラウザのサポート
location.search
すべてのブラウザでサポートされています:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |