Reputation: 27689
How to reload the page using History.js (when clicking the same/active page/link again)?
When you navigate to /home
in the menu bar, and after the page is done loading you click /home
again the page doesn't reload??
https://github.com/browserstate/History.js/
History.pushState(data, title, url);
When clicking the same link again the page doesn't reload? Can't really figure out why?
Have also tried to use the replaceState()
method
Upvotes: 1
Views: 374
Reputation: 27689
var currentLocation = document.location.pathname + decodeURIComponent(document.location.search);
if (currentLocation == url) {
console.log("Refresh");
$(window).trigger('statechange');
} else {
History.pushState(null, title, url);
}
Upvotes: 1