How can I update the url without navigating?

Hi All,

Is there a way to update the url without calling navigate?
For example, i would navigate to http://host.com/person and then wish to update it to http://host.com/person?action=edit&id=1 without calling the navigate to method.

Hi Yusuf,

You can do it like this:

UI.getCurrent().getPage().getHistory().pushState(null, "http://host.com/person?action=edit&id=1");

Mehdi Javan:
Hi Yusuf,

You can do it like this:

UI.getCurrent().getPage().getHistory().pushState(null, "http://host.com/person?action=edit&id=1");

Much appreciated. I did read the documentation, but it wasn’t clear enough.

May I ask what you would change in or add to [the History API document]
(https://vaadin.com/docs/v14/flow/advanced/tutorial-history-api.html)? Your feedback help us improve it.

Mehdi Javan:
May I ask what you would change in or add to [the History API document]
(https://vaadin.com/docs/v14/flow/advanced/tutorial-history-api.html)? Your feedback help us improve it.

Hi Mehdi,

I did not associate history api with the current url. I associated history with managing the previous states of the application.
According to the documentation.

The History API allows you to access the browser navigation history from the server-side.

I guess it boils to down to the definition of history.