简体   繁体   中英

GWT: forward user to a URL

Really simple question: From within GWT I want to forward the user away from my GWT page to a certain URL. What is the best way to do this?

You could create a native method:

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

}-*/; 

This would set the current browser URL to be the address you specify.


Alternative with GWT's API (thanks, Hilbrand):

Window.Location.assign(url);

Try this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM