-
Notifications
You must be signed in to change notification settings - Fork 5
sp core library.urlqueryparametercollection
Home > @microsoft/sp-core-library > UrlQueryParameterCollection
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
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
Constructor | Modifiers | Description |
---|---|---|
(constructor)(url) | Constructs a new instance of the UrlQueryParameterCollection class |
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. |