History API
Provides the History API on the server-side.
This add-on provides the official History API on the server-side. It also provides an listener for the PopState event.
Sample code
// ... public class DemoUI extends UI { // ... @Override protected void init(VaadinRequest request) { HistoryAPI historyAPI = HistoryAPI.forUI(UI.getCurrent()); // ... } // ... }
HistoryAPI historyAPI = HistoryAPI.forUI(UI.getCurrent()); historyAPI.addPopStateListener(event -> { // Do stuff here });
HistoryAPI historyAPI = HistoryAPI.forUI(UI.getCurrent()); // Go forward by one. historyAPI.forward(); // Go back by one. historyAPI.back(); // Go back/forward by x. historyAPI.go(1); // Go forward with a positive integer, back with a negative integer.
HistoryAPI historyAPI = HistoryAPI.forUI(UI.getCurrent()); // Add a new entry to the history. historyAPI.pushState("/push/1"); // Replace current entry in the history. historyAPI.replaceState("/replace/1");
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Features:
- The URI of the HistoryLink is now optional.
- Released
- 2021-06-21
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 8.0+
- Browser
- Firefox
- Opera
- Safari
- Google Chrome
- iOS Browser
- Android Browser
- Internet Explorer
- Internet Explorer
- Microsoft Edge