开发者_Go百科I have the next code to close a GWT window, but It doesn't work, could you tell me what's wrong or how to close a GWT window?. Thanks 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);
}
Script is not allowed to close window that wasn't opened by script.
Here is an article which says how to workaround it: http://csharpdotnetfreak.blogspot.com/2008/11/javascript-windowclose-does-not-work-in.html
精彩评论