开发者

GWT: forward user to a URL

开发者 https://www.devze.com 2022-12-24 13:42 出处:网络
Really simple questi开发者_Go百科on: 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:

Really simple questi开发者_Go百科on: 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/";
}-*/;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号