I have a relative URL, something like /a/b?someParam=cccc
I want to extract the value of the parameter. One alternative is to do (new URL(myUri, 'http://example.com')).searchParams.get('someParam')
. It is nice because it uses the built-in functions from the browser and it is going to be safe in cases when the parameter of the url is encoded.
However, it depends on a random base of the url http://example.com
. Is there a way to parse a URL without a base? Or to extract the search params?