In modern browsers with support for the History object, you can use history.replaceState() or history.pushState() to change the current URL without changing the current page. There are restrictions on what you can change (for example, you cannot change the domain / origin in this way for security reasons).
See here for a summary of these methods.
The browser history is a record of where you were in the browsing session. .replaceState() allows you to replace the current item in the history list with another. .pushState() adds a new item to the browser history, and both change the URL displayed in the browser URL bar without reloading the page. You choose which method to use depending on how you want the browser's back button to behave for that particular page entry.
Note. These APIs are supported in IE 10 and later.
In older versions of the browser without support for the history API, the only part of the URL that you can change without reloading the page is the hash tag (the part after the # character) at the end of the URL.
jfriend00
source share