Is there way for a GWT program to tell if it's in hosted or web mode?

亡梦爱人 提交于 2020-01-01 02:50:07

问题


I would like my GWT program to be able to determine whether it's in hosted mode or in web mode. Is there a way to do this?

Thanks!


回答1:


GWT.isScript() returns true in non hosted mode and false in hosted mode.

http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/core/client/GWT.html#isScript()




回答2:


Be careful with this. You still can't run unemulated Java code in the statement.

if(GWT.isScript()) {
  //some code not in the JRE emulation here
}

The example code will cause compile time problems.



来源:https://stackoverflow.com/questions/223373/is-there-way-for-a-gwt-program-to-tell-if-its-in-hosted-or-web-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!