accessing the compiled javascript from a stand alone project.

28 views
Skip to first unread message

Andrew

unread,
Jan 18, 2012, 7:53:18 AM1/18/12
to Google Web Toolkit
Hi,

I have successfully converted a java project to javascript through gwt
and would like to take that javascript and execute it from a separate
stand alone project.

I have compiled it (using "ant gwtc") and can run the compiled code
through the demo mode server (removing ?gwt.codesvr=127.0.0.1:9997
from the URL so I'm accessing the compile version at:
http://127.0.0.1:8888/ProjectName.html) but it doesn't work if I just
open the .html file straight from disk.

Looking at the .nocache.js file I see there is code in there related
to hosted mode. Does that need a server running to work properly?
Also, in the .cache.html files, the javacript is actually commented
out.

Is there a way to compile it so I have easier access to the javacript
entry point of my code, or to easily extract it from the cache files?

Thanks,
Andrew

Andrew

unread,
Jan 18, 2012, 10:09:18 AM1/18/12
to Google Web Toolkit
Actually, looking at the developer tools error message in chrome, I
see this:
Unsafe JavaScript attempt to access frame with URL file:///abc/xyz.html
from frame with URL file:///abc/ijk.cache.html. Domains, protocols and
ports must match.

Which means I'm running in to a problem regarding security
restrictions imposed on webpages accessed as local files, as described
here:
http://nexnet.wordpress.com/2011/05/20/gwt-script-does-not-load-in-chrome-and-internet-explorer/

I've now run the compiled version from disk by starting chrome with
the –allow-file-access-from-files flag, so am happy that it is
compiled in a way that doesn't require the server.
However, the question remains: is there a way to compile it so I have
easier access to the javacript entry point of my code, or to easily
extract it from the cache files so I can call it from another
javascript project?

Thanks,
Andrew

Thomas Broyer

unread,
Jan 19, 2012, 11:07:00 AM1/19/12
to google-we...@googlegroups.com
Add <add-linker name="xsiframe" /> to make it work "cross site" (as files loaded from the file system all have different "origins", you need something that supports "cross origin" loading)

Carlos

unread,
Apr 11, 2012, 3:07:41 PM4/11/12
to google-we...@googlegroups.com
Hi Thomas,

I have tried this and It works on Chrome, but it doesn't works on firefox for example.... is there another tweak or compiler option to make "cross site"

Thank you
Reply all
Reply to author
Forward
0 new messages