CloseHandler<Window> and Window.ClosingHandler() working differently in IE

Posted by stuff22 on Stack Overflow See other posts from Stack Overflow or by stuff22
Published on 2010-04-06T18:09:08Z Indexed on 2010/04/06 18:13 UTC
Read the original article Hit count: 290

It seems that CloseHandler and Window.ClosingHandler() are not working or are not triggering the events in the same way under IE as opposed to Firefox.

 Window.addWindowClosingHandler(new Window.ClosingHandler() {

                    @Override
                    public void onWindowClosing(ClosingEvent event) {
                        event.setMessage(message);

                    }




         Window.addCloseHandler(new CloseHandler<Window>() {

                    @Override
                    public void onClose(CloseEvent<Window> event) {
                        //Window.alert("debug1");
                        if(recordId!=null){


                            DatabaseQueryServiceAsync dbQueryService = DatabaseQueryService.Util.getInstance();
                            dbQueryService.releaseRecordLock(recordId, new AsyncCallback<String>() {

                                @Override
                                public void onFailure(Throwable arg0) {
                                }

                                @Override
                                public void onSuccess(String arg0) {

                                }
                            });



                        }
                    }


                });

                });

For example, the ClosingHandler under IE displays the message when I swap a panel within within my widget. This does not occur in Firefox.

The CloseHandler doesn't seem to trigger at all when the window closes in IE, but does so in firefox. The interesting thing to point out there, is that when I put a Window.alert("debug1") message in the addCloseHandler() method it DOES run the callback below, but as soon as I remove it, the callback doesn't happen. In firefox it works and runs the callback in both situations. So, I'm basically pulling my hair out not really understanding what's going on. Any help would be greatly appreciated. Thanks.

© Stack Overflow or respective owner

Related posts about gwt

Related posts about java