Tuesday, April 24, 2012

Re: Window.open() opens as a popup

You have to make sure that you directly call Window.open() in the ClickHandler. Don't to it in a Timer, deferred command or similar inside the ClickHandler. The Browser must recognize that Window.open() is directly called because of a user action. It does not matter if its a Button or an Anchor.
Also don't do Window.open() somewhere deep in a sub function called inside the ClickHandler.

Something like the following will work:

Button b = new Button("Test");
b.addClickHandler(new ClickHandler() {
  void onClick(ClickEvent e) {
    Window.open("http://www.google.de", "_blank", "");
  }
});

If you wrap Window.open() for example in a Timer it won't work anymore.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/AgiBk4VnjUEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment