Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

typescript read url parameters

// get all search params (including ?)
const queryString = window.location.search;
// it will look like this: ?product=shirt&color=blue&newuser&size=m

// parse the query string's paramters
const urlParams = new URLSearchParams(queryString);

// To get a parameter simply write something like the follwing
const paramValue = urlParams.get('yourParam');
Source by www.sitepoint.com #
 
PREVIOUS NEXT
Tagged: #typescript #read #url #parameters
ADD COMMENT
Topic
Name
2+1 =