Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT back button browser

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?

like image 559
msaif Avatar asked May 09 '10 14:05

msaif


People also ask

Where is the back button on my browser?

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.

Why is there no back button on my Chrome?

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.

How do I get the old page button back?

You can use the history. back() method to tell the browser to go back to the user's previous page.


1 Answers

+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. */
like image 85
Chris Lercher Avatar answered Oct 18 '22 07:10

Chris Lercher