pushing fix to ajaxify where the homepage did not get added to the history (and thus was unreachable via history action

This commit is contained in:
Julian Lam
2013-05-15 11:34:05 -04:00
parent 98193ecb29
commit e4364b5362

View File

@@ -21,8 +21,8 @@ var ajaxify = {};
window.onpopstate = function(event) {
console.log('popstate called:', event);
if (event !== null && event.state && event.state.url) ajaxify.go(event.state.url, null, null, true);
console.log('popstate called:', event.state);
if (event !== null && event.state && event.state.url !== undefined) ajaxify.go(event.state.url, null, null, true);
};
ajaxify.go = function(url, callback, template, quiet) {
@@ -43,6 +43,9 @@ var ajaxify = {};
if (templates[tpl_url]) {
if (quiet !== true) {
console.log('state pushed', {
"url": url
});
window.history.pushState({
"url": url
}, url, "/" + url);