URLUtils.searchParams

The URLUtils.searchParams property is a URLSearchParams containing the query/search parameters of the URL.

Note: This feature is available in Web Workers.

Syntax

JavaScript
object2 = object.searchParams;
object.searchParams = object2;

Examples

JavaScript
var anchor = document.createElement("a");
anchor.href = "https://developer.mozilla.org/en-US/search?q=URLUtils.searchParams&topic=api"
var searchParams = anchor.searchParams;

searchParams.has("topic") === true; // true
searchParams.get("topic") === "api"; // true
searchParams.getAll("topic"); // ["api"]
searchParams.get("foo") === ""; // true
searchParams.append("topic", "webdev");
searchParams.toString(); // "q=URLUtils.searchParams&topic=api&topic=webdev"
searchParams.delete("topic");
searchParams.toString(); // "q=URLUtils.searchParams"
anchor.href; // "https://developer.mozilla.org/en-US/search?q=URLUtils.searchParams"

Specifications

Specification Status Comment
URL Living Standard Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support Not supported 29.0 (29.0) Not supported Not supported Not supported
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported Not supported 29.0 (29.0) Not supported Not supported Not supported

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/htmlhyperlinkelementutils/searchparams

API Experimental Expérimental Property URI API URLUtils