diff --git a/source/Ox.UI/js/Core/Ox.URL.js b/source/Ox.UI/js/Core/Ox.URL.js index 00d643f2..f6655029 100644 --- a/source/Ox.UI/js/Core/Ox.URL.js +++ b/source/Ox.UI/js/Core/Ox.URL.js @@ -159,8 +159,16 @@ Ox.URL = function(options) { Ox.Log('Core', 'Ox.URL options', self.options) + self.previousTitle = ''; self.previousURL = ''; + window.onpopstate = function() { + self.previousTitle = document.title; + self.previousURL = document.location.pathname + + document.location.search + + document.location.hash; + }; + function constructCondition(condition) { var key = condition.key == '*' ? '' : condition.key, operator = condition.operator, @@ -585,22 +593,12 @@ Ox.URL = function(options) { } - that._construct = function(state) { - return constructURL(state); - }; - that.parse = function() { var str = arguments.length == 2 ? arguments[0] : document.location.pathname + document.location.search + document.location.hash, callback = arguments[arguments.length - 1]; - /* - parseURL(str, function(state) { - that.replace(constructURL(state)); - callback(state); - }); - */ parseURL(str, callback); return that; } @@ -609,8 +607,11 @@ Ox.URL = function(options) { pop Sets the URL to the previous URL @*/ that.pop = function() { - history.pushState({}, '', self.previousURL); - return that; + if (self.previousURL) { + history.pushState({}, self.previousTitle, self.previousURL); + document.title = self.previousTitle; + } + return !!self.previousURL; }; /*@ @@ -634,6 +635,7 @@ Ox.URL = function(options) { pushState(state, title, url); } function pushState(state, title, url) { + self.previousTitle = document.title; self.previousURL = document.location.pathname + document.location.search + document.location.hash;