check if history.pushState exists

This commit is contained in:
rolux 2012-05-25 19:58:43 +02:00
parent 2d7b8917cc
commit b0000b5169

View file

@ -649,7 +649,9 @@ Ox.URL = function(options) {
@*/ @*/
that.pop = function() { that.pop = function() {
if (self.previousURL) { if (self.previousURL) {
history.pushState({}, self.previousTitle, self.previousURL); history.pushState && history.pushState(
{}, self.previousTitle, self.previousURL
);
document.title = self.previousTitle; document.title = self.previousTitle;
} }
return !!self.previousURL; return !!self.previousURL;
@ -681,7 +683,9 @@ Ox.URL = function(options) {
+ document.location.search + document.location.search
+ document.location.hash; + document.location.hash;
if (url != self.previousURL) { if (url != self.previousURL) {
history.pushState(Ox.extend(state, {title: title}), '', url); history.pushState && history.pushState(
Ox.extend(state, {title: title}), '', url
);
document.title = title; document.title = title;
callback && callback(state); callback && callback(state);
} }