I ‘d like to grab the current URL, replace a part of the pathname within it, and open the result in a new tab.
The current URL looks something like this:
http://website.com/file.php?identificator=11111&folder=name
I would like to get the URL (I assume using “window.location” to be most suitable (?)), then replace the parameter “name” (variable, could be different at any time) with “name2” (fixed value) and open resultant URL in a new tab, possibly multiple times.
I’ve tried looking into replace(), but couldn’t get into isolating the parameter inside the pathname.
How would one proceed? jQuery could be a possible replacement too.
Thanks for any help.
*untested code