Fix the interaction between the history API and window.location.

For example, window.location.hash would not be updated.