I’m working on a tool which takes the value parameters in the URL and does a few things with them.
My issue is, I can’t seem to use document.location to show the specifi
let url = new URL('www.examplesite.com?yourname=gilgilad');
let searchParams = new URLSearchParams(url.search);
console.log(searchParams.get('yourname'));
you can consider also to user window.location
or window.location.search
directly
let searchParams = new URLSearchParams(window.location.search);
console.log(searchParams.get('yourname'));