I'm facing an issue with modifying the URL after opening a new window and navigating to a state.
Starting from my initial page:
localhost:8000/startpage.html
.
Upon loading, the URL transforms into
localhost:8000/startpage.html#/
.
Now, in the new window, I navigate to a different state:
localhost:8000/startpage.html#/newstate
.
My goal is to have the URL structured as follows:
localhost:8000/startpage.html?project=1#/newstate
.
However, I am encountering an issue where instead of completely replacing the URL, it appends
?project=1#/newstate
to localhost:8000/startpage.html#/
.
Consequently, the outcome looks something like this:
localhost:8000/startpage.html#/%3Fproject=903%23/newstate
when what I actually need is:
localhost:8000/startpage.html?project=903#/newstate
Below is some relevant code snippet:
if ($window.history.replaceState) {
var newUrl = '?project=903' + '#/case';
$location.path(newUrl);
$location.replace();
};
It seems that there are two main issues at play here. The extra '#/' after '.html' and the encoding of the URL. Even if I remove the additional '#/', it doesn't function properly unless I replace the encoded characters with their actual counterparts. Any assistance provided would be greatly appreciated.
Thank you.