开发者

How to close a window in GWT?

开发者_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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜