How to Get Query String Parameters From Website URL Using JavaScript in Browser Full Project For Beginners


Welcome folks today in this blog post we will be getting query string parameters from website url using javascript. All the full source code of the application is shown below.




Get Started




In order to get started you need to make an index.html file and copy paste the following code







var queryString =;
// ?type=product&id=1234

var urlParams = new URLSearchParams(;

urlParams.has('type');  // true
urlParams.get('id');    // 1234
urlParams.getAll('id'); // ["1234"]
urlParams.toString();   // type=product&id=1234

Leave a Reply