GWT: redirect user to url

A really simple question: from GWT, I want to redirect a user from my GWT page to a specific URL. What is the best way to do this?

+3
source share
2 answers

You can create your own method:

public static native void setWindowHref(String url)/*-{
        $wnd.location.href = url;

}-*/; 

This would set the current browser url you specify.


Alternative with GWT API (thanks, Hilbrand):

Window.Location.assign(url);
+5
source

Try the following:

public static native void leavePage() /*-{
   $wnd.location.href = "http://www.certainurl.com/";
}-*/;
+1
source

Source: https://habr.com/ru/post/1738629/


All Articles