How can you set URL parameters using History.pushState()
to avoid browser refreshes? If there is a not a simple JS solution, is there already a popular library or b
Answering to the question in your comment, you'd be able to read those properties from history.state
, a property that holds the value of the stat for the current URL. Whenever you go back and forward you'll receive a popstate
event and you will be able tor read the state you pushed, which is far easier than dealing with urls.
Of course, when you go back or forward to a new entry in the history list pushed with pushState()
or replaceState()
the page does not reload.
You can read more about the History object in the MDN.