Compare commits

..
1 Commits
Author SHA1 Message Date
lukas c8e5bd98cc Fix AJAX popstate event 2016-08-16 11:19:55 +02:00
+5 -2
View File
@@ -56,10 +56,10 @@
// Just scroll to the top/element if the link points to the current page
// In this case, we also don't want to reload, so we return true
if(target.pathname === window.location.pathname) {
if(mode === 'normal' && target.pathname === window.location.pathname) {
var element;
if(target.hash) {
if(mode === 'normal' && target.hash !== '#top') {
if(target.hash !== '#top') {
history.pushState({}, document.title, target.href);
}
element = document.getElementById(target.hash.substr(1));
@@ -162,6 +162,9 @@
if(app.go(link)) e.preventDefault();
});
// Replace the state for the normal page load
history.replaceState({}, document.title, window.location.href);
// Listen on the popstate event on window
window.addEventListener('popstate', function(e) {
if(e.state !== null) app.go(window.location.href, 'popstate');