8

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

1
  • please mark the answer that you found helpful correct.
    – tpow
    Commented Nov 9, 2011 at 20:49

3 Answers 3

20

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);
1
  • This doesn't seam to support keeping access to the state of the application. Commented Jul 18, 2012 at 9:25
5

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","");

From the link

_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

Not the answer you're looking for? Browse other questions tagged or ask your own question.