How to close a window in GWT?

I have the following code to close the GWT window, but it does not work, could you tell me what is wrong or how to close the GWT window ?. Thank you in advance:

public native void closeBrowser() /*-{ $wnd.close(); }-*/; public void onModuleLoad() { Button cerrar = new Button("Cerrar"); cerrar.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.alert("Voy a cerrar"); closeBrowser(); } }); RootPanel.get().add(cerrar); } 
+4
source share
1 answer

Script is not allowed to close a window that the script has not opened.

Here is an article that tells how to get around it: http://csharpdotnetfreak.blogspot.com/2008/11/javascript-windowclose-does-not-work-in.html

+3
source

All Articles