Using HTML5 pushState() in IE9

我的未来我决定 提交于 2019-11-28 08:57:57
amosrivera

History.js

Quote from the repo:

History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState. Supports jQuery, MooTools and Prototype. For HTML5 browsers this means that you can modify the URL directly, without needing to use hashes anymore. For HTML4 browsers it will revert back to using the old onhashchange functionality.

As per Ember documentation about history api: http://emberjs.com/api/classes/Ember.Location.html

Browsers that support the history API will use HistoryLocation, those that do not, but still support the hashchange event will use HashLocation, and in the rare case neither is supported will use NoneLocation.

App.Router.map(function() {
  this.resource('posts', function() {
    this.route('new');
  });
});

App.Router.reopen({
  location: 'auto'
});

This will result in a posts.new url of /posts/new for modern browsers that support the history api or /#/posts/new for older ones, like Internet Explorer 9 and below.

When a user visits a link to your application, they will be automatically upgraded or downgraded to the appropriate Location class, with the URL transformed accordingly, if needed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!