Search code examples
gwtgxt

How to close a window using GWT or Ext-GWT (GXT)?


I wanna close the browser window (similar to javascript:window.close()). Is there any correpsponding API in GWT or in Ext-GWT (GXT)?

I don't want to make a native call to do this, I want a Java solution.

native public static void close()/-{ $wnd.close(); }-/;

Thanks in advance.


Solution

  • GWT provides access to browser window's methods via the class com.google.gwt.user.client.Window with some static methods. Currently there is no close() method (unlike open()). Since the GWT Window class itself is working with the JSNI I don't think you will find a possibility to access the browser window in a pure Java way (and how should that work at all?). If you don't want to use JSNI in your existing code you could create something like the GWT Window class adjusted to your needs.