让我们假设我做了以下事情:
window.onpopstate = function(event) {
var currentState = event.state; // returns {foo:bar}
var previousState = ... ; // how to access {foo:baz}
};
history.pushState({foo:'bar'});
history.pushState({foo:'baz'});
history.back();
[null, {foo:bar}, {foo:baz}]