GWT Popup window in new browser window

北战南征 提交于 2020-01-14 07:40:51

问题


I am trying to open new pop up window (browser window ) on click of button . Please suggest how to impement it.


回答1:


This should give you the basic idea on how to do this.

    Button openWindow = new Button("Open Window");
    openWindow.addClickHandler(new ClickHandler() {

        public void onClick(final ClickEvent clickEvent) {
            Window.open("http://google.com", "_blank", null);
        }
    });
    RootPanel.get().add(openWindow);



回答2:


Using Window.open() inside a Button's ClickHandler should do the trick.




回答3:


We have to use HTML's Target attribute to tell the browser,that where it should open.

Window.open("www.google.com","_blank","");

_blank Opens the linked document in a new window or tab

_self Opens the linked document in the same frame as it was clicked (this is default)

_parent Opens the linked document in the parent frame

_top Opens the linked document in the full body of the window



来源:https://stackoverflow.com/questions/1735182/gwt-popup-window-in-new-browser-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!