tags:

views:

431

answers:

2

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!

+4  A: 

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()

Tony BenBrahim
A: 

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.

angryundead