Check history.state before calling replaceState initially.