我建议History.js作为填充工具的浏览器不支持历史API: https://github.com/browserstate/history.js
它是工作在:
HTML5浏览器:
火狐4+
铬8+
歌剧11.5
Safari 5.0及
Safari浏览器的iOS 4.3+
HTML4浏览器:
IE 6,7,8,9
Firefox 3的
Opera 10的,11.0
Safari 4的
Safari浏览器的iOS 4.2,4.1,4.0,3.2
添加jquery.history.js &注册一个history.js位置处理成灰烬你应用。
下面是我从原来的修改部分Ember.HistoryLocation ( 完整代码 )
(function() {
var get = Ember.get, set = Ember.set;
var popstateFired = false;
Ember.HistoryJsLocation = Ember.Object.extend({
initState: function() {
this.replaceState(this.formatURL(this.getURL()));
set(this, 'history', window.History);
},
getState: function() {
return get(this, 'history').getState().state;
},
pushState: function(path) {
History.pushState({ path: path }, null, path);
},
replaceState: function(path) {
History.replaceState({ path: path }, null, path);
}
});
Ember.Location.registerImplementation('historyJs', Ember.HistoryJsLocation);
})();
然后用这个填充工具在您的应用程序:
App.Router.reopen({
location: 'historyJs'
});