On 16 déc, 18:42, Damon Lundin <damon.lun...@gmail.com> wrote:
> I have a need to implement a "Are you sure you want to leave?"
> functionality that can prevent the user from leaving the page (the
> same thing Gmail does) when there is unsaved data. All the
> documentation I've read says that you can do this by returning a
> string from the window.onbeforeunload method. This works if I embed
> raw javascript in my html page, but it doesn't seem to work when I
> make a native GWT method to do that same thing.
In GWT, use Window.addWindowClosingHandler and setMessage on the
Window.ClosingEvent.
Well, how about that? That works. Thank you very much!
I'm still a little curious though why the JSNI version doesn't work.