Ember documentation states that it can be set to use the History API for routing rather than hash-based fragments by using:
App.Router.reopen({
location: 'history'
});
But I can find no mention of what will happen if a browser doesn't support the History API. Will it fall back to using a hash like History.js?
If not, should I check for History API support and switch history implementation to hash if it isn't supported?
There doesn't seem to be any History API support detection in the ember source.
So if you set location
to history
, and there's no support, your routing will probably fail.
If you intend to support old browsers, safest bet is like you said:
if (window.history && window.history.pushState) {
App.Router.reopen({
location: 'history'
});
}
You can now use location:'auto'
if you enable ember-routing-auto-location
feature in canary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With