Use history.replaceState if available