4

I'm new in using GWT.

When I heard about GWT I thought than I will be able to compile Java code to html+css+js files and can use it offline without any webserver. Now, when I'm reading how tos about starting with GWT I see that compiled GWT application has to be deployed before starting it in webbrowser.

Is any way to compile GWT to plain html files and run it in browser by simply clicking some html file?

1 Answer 1

7

Try adding the following to your gwt.xml:

<add-linker name='xsiframe' />

The reason is that files loaded from the filesystem are all treated as if they came from different origins, so it's really easy to be caught by the so-called same-origin policy.

By default (using the std linker), GWT outputs *.cache.html files that are loaded in an iframe, so, being from different origins, the code in the iframe cannot talk to the HTML host page.

Using the xsiframe linker (or the now-deprecated xslinker), GWT generates *.cache.js files that are loaded using scripttags, which allows loading scripts cross-origins.

See https://developers.google.com/web-toolkit/doc/latest/FAQ_Server#What_is_the_Same_Origin_Policy,_and_how_does_it_affect_GWT?

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much Thomas. This is what I need. It works. I don't event have to connect to server and use my gwt application as client. I want to only create simply html+css+js GUI application using awsome gwt features.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.