Back Button which works similar to browser back button

Hello,

I am new to vaadin framework and I was unable to find a functionality which can take the users to the previous page in the browser history.
I was looking for a functionality similar to window.history.back() in javascript. We have navigator.navigateToView in vaadin, but is there a way the users can just navigate to the previous page on click of a button?

Thanks a lot for your time and inputs.

Regards,
Riswan

You could either put all navigated views on a stack and pull the previous one from there in order to navigate back on button-click. Or you implement a button, that calls

Page.getCurrent().getJavaScript().execute("alert('window.history.back()')"); in its ClickListener.

Dear Tobias,

Thanks a lot! this was very helpful. I tried the javascript example:

Page.getCurrent().getJavaScript().execute(“window.history.back()”);

and this worked fine. (Though the page response is a little slow).

Regards,
Riswan