From 459d5ddccdb185734ce7a5509f7b005b12ebaa66 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 24 Jan 2014 10:09:28 -0500 Subject: [PATCH] fixed #867 - added proper detection so that onpopstate would not react if it was a proper page load --- public/src/ajaxify.js | 3 ++- src/webserver.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 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 pushState diff --git a/src/webserver.js b/src/webserver.js index 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 remove var routerScript = '';