1

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.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
elloalisboa
  • 3,053
  • 2
  • 17
  • 10

1 Answers1

0

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.

Simson
  • 829
  • 6
  • 16
  • 1
    You are right, there is no way to don't use a JSNI solution, but in FF it doesn't work without change a variable in browser http://stackoverflow.com/questions/760422/how-can-i-close-a-window-with-javascript-on-mozilla-firefox-3 – elloalisboa Sep 06 '11 at 14:58
  • @elloalisboa: Thanks for the hint. That's good to know... Until know, I never needed this function in production. – Simson Sep 06 '11 at 17:50