Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

sp core library.urlqueryparametercollection

John Nguyen edited this page Apr 22, 2021 · 2 revisions

Home > @microsoft/sp-core-library > UrlQueryParameterCollection

UrlQueryParameterCollection class

Warning: This API is now obsolete.

Use the URLSearchParams browser API instead. The SharePoint Framework includes a polyfill for older browsers.

Provides features for storing and retrieving URL query parameters.

Signature:

export default class UrlQueryParameterCollection

Remarks

The URL can be server-relative, and it can also be an empty or null string. The query parameters must start with "?" to indicate the first query parameter and use "&" for all subsequent parameters. The class also supports fragments.

Edge case behavior:

Empty value (www.example.com/?test=) stores key and empty value No equals in queryParam (www.example.com/?test) stores key and undefined value Empty queryParam (www.example.com/?&debug=on) stores undefined key and value Query param with only equals (www.example.com/?=&debug=on stores empty string key and value

Constructors

Constructor Modifiers Description
(constructor)(url) Constructs a new instance of the UrlQueryParameterCollection class

Methods

Method Modifiers Description
getValue(param) Returns the value of the first matching query parameter or undefined if the key doesn't exist.
getValues(param) Returns the values of all of the matching query parameters or undefined if the key doesn't exist.
Clone this wiki locally