Is it possible to rewrite a pages URL without having the page reload it self via Javascript when setting the window.location to slash?
For example, I have an a href item that sets the link to #item1
<a href="#item1">
and then it's linked up via to a js class that pulls a popup open and when the popups close button is pressed I then rewrite the url to
window.location = "/#";
Is it possible to rewrite the url to so that there is no hash remaining?
window.location = "/";
Without having the webpage reload it self since / means home?
You should check out the History API.
http://diveintohtml5.info/history.html
https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history
var stateObj = { home: "home" };
history.pushState(stateObj, "home", "/");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.