Polyfill history.state for non-supporting browsers

When using HistoryLocation, the url is not properly updated in browsers that don't support history.state (Safari 5, Mobile Safari iOS5, various Android).

Fixes #2365, #2551