In my GWT application, I want to ask the user for confirmation when they switch from the current application, i.e. by entering the URL or closing the browser. This is usually done by registering the ClosingHandler and setting the desired dialog message in the onWindowClosing method. This seems to work well.
However, if a user tries to switch from say to http://www.gmail.com (by typing it in the URL bar) and clicking Cancel to indicate that he does not want to navigate, my application continues to work but http://www.gmail.com displayed in the browser URL bar http://www.gmail.com . This causes a number of problems later in my application and will give the wrong result if the user closes the page.
Is there a way to automatically reset the URL when the user clicks Cancel ?
Or, conversely, is there a way to detect that the user has clicked Cancel ? If so, is there a way to set the url without running a ValueChangeEvent ? (I could add some logic to prevent this, but I would rather use the built-in mechanism if one exists.)
source share