const url = new URL(
'http://example.com/path/index.html?message=hello&who=world'
);
console.log(url.searchParams.get('message')); // => 'hello'
console.log(url.searchParams.get('missing')); // => null
console.log(url.pathname); // => '/path/index.htm