Reputation: 43
I have a problem. How can i remove from url "content" added by history.pushState? For example i have a this url:
site.com
Ok, now i update this url to this:
site.com/site/subsite
How i can restore default url (site.com).
I try history.pushState("",document.title,document.location.pathname)
but,
document.location.pathname
is "site.com/site/subsite"
and i return to start point :(
Upvotes: 3
Views: 2406
Reputation: 8723
history.pushState("", document.title, "/");
It will remove state completely from the domain url.
Upvotes: 5