From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- files/uk/web/api/urlsearchparams/index.html | 171 ++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 files/uk/web/api/urlsearchparams/index.html (limited to 'files/uk/web/api/urlsearchparams') diff --git a/files/uk/web/api/urlsearchparams/index.html b/files/uk/web/api/urlsearchparams/index.html new file mode 100644 index 0000000000..78ab36b8e8 --- /dev/null +++ b/files/uk/web/api/urlsearchparams/index.html @@ -0,0 +1,171 @@ +--- +title: URLSearchParams +slug: Web/API/URLSearchParams +translation_of: Web/API/URLSearchParams +--- +

{{ApiRef("URL API")}}

+ +

URLSearchParams інтерфейс визначає корисні методи для роботи з довгими текстовими URL.

+ +

Об'єктна реалізація URLSearchParams може використовуватись напряму в {{jsxref("Statements/for...of", "for...of")}} структурі, замість {{domxref('URLSearchParams.entries()', 'entries()')}}: for (var p of mySearchParams) що еквівалентно до for (var p of mySearchParams.entries()).

+ +

Конструктор

+ +
+
{{domxref("URLSearchParams.URLSearchParams", 'URLSearchParams()')}}
+
Конструктор вертає URLSearchParams об'єкт.
+
+ +

Properties

+ +

This interface doesn't inherit any property.

+ +

Методи

+ +

Інтерфейс на наслідує ніяких методів

+ +
+
{{domxref("URLSearchParams.append()")}}
+
Appends a specified key/value pair as a new search parameter.
+
{{domxref("URLSearchParams.delete()")}}
+
Deletes the given search parameter, and its associated value, from the list of all search parameters.
+
{{domxref("URLSearchParams.entries()")}}
+
Returns an {{jsxref("Iteration_protocols","iterator")}} allowing to go through all key/value pairs contained in this object.
+
{{domxref("URLSearchParams.get()")}}
+
Returns the first value associated to the given search parameter.
+
{{domxref("URLSearchParams.getAll()")}}
+
Returns all the values association with a given search parameter.
+
{{domxref("URLSearchParams.has()")}}
+
Returns a {{jsxref("Boolean")}} indicating if such a search parameter exists.
+
{{domxref("URLSearchParams.keys()")}}
+
Returns an {{jsxref("Iteration_protocols", "iterator")}} allowing to go through all keys of the key/value pairs contained in this object.
+
{{domxref("URLSearchParams.set()")}}
+
Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
+
{{domxref("URLSearchParams.toString()")}}
+
Returns a string containg a query string suitable for use in a URL.
+
{{domxref("URLSearchParams.values()")}}
+
Returns an {{jsxref("Iteration_protocols", "iterator")}} allowing to go through all values of the key/value pairs contained in this object.
+
+ +

Example

+ +
var paramsString = "q=URLUtils.searchParams&topic=api"
+var searchParams = new URLSearchParams(paramsString);
+
+//Iterate the search parameters.
+for (let p of searchParams) {
+  console.log(p);
+}
+
+searchParams.has("topic") === true; // true
+searchParams.get("topic") === "api"; // true
+searchParams.getAll("topic"); // ["api"]
+searchParams.get("foo") === null; // true
+searchParams.append("topic", "webdev");
+searchParams.toString(); // "q=URLUtils.searchParams&topic=api&topic=webdev"
+searchParams.set("topic", "More webdev");
+searchParams.toString(); // "q=URLUtils.searchParams&topic=More+webdev"
+searchParams.delete("topic");
+searchParams.toString(); // "q=URLUtils.searchParams"
+
+ +

Specifications

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('URL', '#urlsearchparams', "URLSearchParams")}}{{Spec2('URL')}}Initial definition.
+ +

Browser compatibility

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatChrome(49)}}{{CompatGeckoDesktop("29.0")}}{{CompatNo}}36{{CompatNo}}
entries(), keys(), values(), and support of for...of{{CompatChrome(49)}}{{CompatGeckoDesktop("44.0")}}{{CompatNo}}36{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidAndroid WebviewFirefox Mobile (Gecko)IE MobileOpera MobileSafari MobileChrome for Android
Basic support{{CompatNo}}{{CompatChrome(49)}}{{CompatGeckoMobile("29.0")}}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}{{CompatChrome(49)}}
entries(), keys(), values(), and support of for...of{{CompatNo}}{{CompatChrome(49)}}{{CompatGeckoMobile("44.0")}}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}{{CompatChrome(49)}}
+
+ +

See also

+ + + +
+
-- cgit v1.2.3-54-g00ecf