Ember 1.0最终Internet Explorer 8和9(历史API - pushState和replaceState)

nar*_*eso 3 ember.js

我的印象是Ember在一些旧版本的IE下经过了很好的测试.然而,在最终启动我的近乎完整的应用程序(表单向导).我注意到IE正在抱怨replaceState和pushState,根据http://caniuse.com/#search=pushState不支持两种方法

这有什么变通方法吗?

SCRIPT438: Object doesn't support property or method 'replaceState'

get(this, 'history').replaceState(state, null, path);

nar*_*eso 10

更新:从Ember 1.5.0+开始,我可以确认他们添加了'auto',这将消除下面例子的需要.

App.Router.reopen({
  location: 'auto'
});
Run Code Online (Sandbox Code Playgroud)

原答案:

显然,您需要检测历史记录API:

if (window.history && window.history.pushState) {
  App.Router.reopen({
    location: 'history'
  });
}
Run Code Online (Sandbox Code Playgroud)