For example current page is www.google.com. But I typed a different website address in address bar and clicked. This site has fully GWT code.
But I like to back to the previous page of www.google.com. So I clicked back button of browser.but how can I get event of back button from current GWT code. Can I set any backbutton event handler in GWT of current page? One which notifies an alert to me that back button was pressed.
Is there any solution from GWT?
In all browsers, the shortcut key combination for the back button is Alt + Left arrow key. Also, the backspace key works in many browser to go back. If you want to return to the page you came back from you can use the forward button after using the back button.
Now, Google Chrome did previously include a Home icon and button in the navigation pane. The button was removed in favor of simply sending users to the New Tab Page via the associated UI several years back. It's also still present, at the top-left-hand side of the navigation bar UI on mobile.
You can use the history. back() method to tell the browser to go back to the user's previous page.
+1 to Igor and Alex. Here's some code you can use, if you want to use the ClosingHandler:
Window.addWindowClosingHandler(new Window.ClosingHandler() {
@Override
public void onWindowClosing(final ClosingEvent event) {
event.setMessage("Don't you think my site is awesome?");
}
});
Some info from the Javadoc of ClosingHandler.onWindowClosing():
/* Fired just before the browser window closes or navigates to a different
* site. No user-interface may be displayed during shutdown. */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With