Right now, the Router only has a `navigate` method that pushes a new entry in the document history.
OOjs Router should support replacing the current entry in the history.
**Illustration**
> History has A.
> `router.navigate( 'B' );`
> History has A, B.
> `router.navigate( 'C' );`
> History has A, B, C.
> `window.history.back()` goes back to B.
> `window.history.back()` goes back to A.
>
> **Goal:**
> History has A.
> `router.navigate( 'B' );`
> History has A, B.
> `router.navigate( 'C', { replace: true } );`
> History has A, C.
> `window.history.back()` goes back to A.
**Context:**
In the last Front-end Standards meeting, the group suggested to use the History API when it is available, because `location.replace()` is known to have inconsistent behaviors.
Right now the Router relies on the `hashchange` event.
We still can't rely only on the History API because we support IE9 and IE9 does not support the History API.
**Proposal:**
- Rewrite the router code to use the History API instead of the hashchange event when possible.
- Abstract the differences between pushState method and hashchange method in OOjs Router.
- **Add a replace history method**:
-- Change signature of `navigate` to support `options.replace = true`:
--- e.g. `router.navigate( path, [options] )`
-- Introduce `replace` method:
--- e.g. `router.replace( path )`
- **Remove** `router.back()` hack, as this should be possible with the new "history replace" method.