Under the hood aren't you pushing things into the browser history as navigation happens? I wouldn't try to rewrite the history api myself but just make sure you `pushState()` as navigation happens.