Syntax :
history.replaceState(data, title [, url ])
This method modifies the current history entry instead of creating a new one. Mainly used when we want to update URL of the current history entry.
window.history.replaceState("http://example.ca", "Sample Title", "/example/path.html");
This example replaces the current history, address bar, and page title.
Note this is different from the history.pushState()
. Which inserts a new history entry, rather than replacing the current one.