Diskdrive
Diskdrive

Reputation: 18855

Is it possible to change the URL without re-loading the page in Meteor?

I remember in Angular, I was able to dynamically change the URL without re-loading the page simply by changing $location

Is this possible to do something similar in Meteor?

I've tried using Router.go but that does reload the page, clearing all the fields.

Upvotes: 0

Views: 479

Answers (1)

Peppe L-G
Peppe L-G

Reputation: 8345

You can use pure JavaScript (in modern browsers) to change the URL without reloading the page. See https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history As an example, evaluate history.pushState({}, "A new page", "myNewPage.html") in the console in your browser, and notice the change in the adressbar.

I guess Iron Router uses this under the hood when you change page.

Upvotes: 3

Related Questions