Class HistoryLocation

protected
Extends: EmberObject
Defined in: packages/@ember/-internals/routing/lib/location/history_location.ts:21
Module: @ember/routing
import HistoryLocation from '@ember/routing/history-location';

HistoryLocation implements the location API using the browser's history.pushState API.

Using HistoryLocation results in URLs that are indistinguishable from a standard URL. This relies upon the browser's history API.

Example:

app/router.js
Router.map(function() {
  this.route('posts', function() {
    this.route('new');
  });
});

Router.reopen({
  location: 'history'
});

This will result in a posts.new url of /posts/new.

Keep in mind that your server must serve the Ember app at all the routes you define.

Using HistoryLocation will also result in location states being recorded by the browser history API with the following schema:

window.history.state -> { path: '/', uuid: '3552e730-b4a6-46bd-b8bf-d8c3c1a97e0a' }

This allows each in-app location state to be tracked uniquely across history state changes via the uuid field.

Methods

Properties

Events

No documented items

© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/3.25/classes/HistoryLocation