mddanishyusuf / dailyhack

🐱‍💻 Tiny Tiny Hacks we use in our daily life.
https://dailyhack.now.sh/
149 stars 15 forks source link

getUrlParameters in Javascript #54

Closed fayazara closed 2 years ago

fayazara commented 5 years ago

Simply use this line to get query parameters from url in Javascript

let urlParams = new URLSearchParams(window.location.search.substring(1)); let value = urlParams.get("query");

anubhavsrivastava commented 5 years ago

Just a cautionary note: doesn't work on evergreen browser, IE.

mddanishyusuf commented 5 years ago

Haha. Yes, we know. But we don't care about IE things now. I think IE developers are lazy to update their web API in the browser. :) @anubhavsrivastava