medialize / URI.js

Javascript URL mutation library
http://medialize.github.io/URI.js/
MIT License
6.26k stars 476 forks source link

Change URL without refreshing page? #361

Closed g5400658 closed 6 years ago

g5400658 commented 6 years ago

I want to add/update a parameter to the current URL without refreshing the page.

Is this something this plugin is capable of? If so, how? Because I can't find documentation on how to do this.

rodneyrehm commented 6 years ago

You're likely looking for History.replaceState(). While URI.js can help you construct the URL, it cannot interact with the browser for you.

var newUrl = URI().addQuery('hello', 'world').resource();
history.replaceState(null, "the new title", newUrl);