Node.js based forum software built for the modern web
fixed #867 - added proper detection so that onpopstate would not react if it was a proper page load
Julian Lam459d5ddccdb1
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.jsindex 86a9c7062a..2f180dde73 100644--- a/public/src/ajaxify.js+++ b/public/src/ajaxify.js@@ -23,7 +23,7 @@ var ajaxify = {};window.onpopstate = function (event) {- if (event !== null && event.state && event.state.url !== undefined) {+ if (event !== null && event.state && event.state.url !== undefined && !ajaxify.initialLoad) {ajaxify.go(event.state.url, null, true);}};@@ -31,6 +31,7 @@ var ajaxify = {};var pagination, paginator_bar;ajaxify.currentPage = null;+ ajaxify.initialLoad = false;ajaxify.go = function (url, callback, quiet) {// "quiet": If set to true, will not call pushStatediff --git a/src/webserver.js b/src/webserver.jsindex 615a3e44c8..bf31fd22f4 100644--- a/src/webserver.js+++ b/src/webserver.js@@ -401,6 +401,7 @@ if(nconf.get('ssl')) {app.create_route = function (url, tpl) { // to removevar routerScript = '<script> \+ ajaxify.initialLoad = true; \templates.ready(function(){ajaxify.go("' + url + '", null, true);}); \</script>';