I'm currently working on an app that generates a unique URL upon logout, allowing users to redirect back to their previous page. For example:
http://localhost:8888/http%3A%2F%2Flocalhost%3A8080%2F%23%2FuserProfile/
However, I am facing an issue where the created URL redirects incorrectly due to a route defined in the login page. Instead of going to the desired path:
http://localhost:8888/#/login/http%3A%2F%2Flocalhost%3A8080%2F%23%2FuserProfile/
I have attempted to resolve this problem using window.history.replaceState()
. Yet, whenever the replacement URL includes a hash (#
), it concatenates the URL like this:
http://localhost:8888/http%3A%2F%2Flocalhost%3A8080%2F%23%2FuserProfile/#/login/http%3A%2F%2Flocalhost%3A8080%2F%23%2FuserProfile
If I omit the hash, the URL appears correct but lacks the necessary fragment (i.e.):
http://localhost:8888/login/http%3A%2F%2Flocalhost%3A8080%2F%23%2FuserProfile/
The lack of detailed documentation on this method is causing confusion. I'm uncertain about the correctness of my approach or if there's a better solution to this issue.