How to enable external Javascript in a standalone GWT application

I have a GWT application (ok, GXT) that uses an external JavaScript library to add functionality to my application. My app needs to work offline as well and that is my problem.

I know adding files to the shared folder will make them available to my GWT application, but that won't work when used offline. GWT compiles my application to make it available offline without issue, but it doesn't include external JavaScript library.

So, whenever I work in the application and get to the point where the specified library is needed, the browser will try to make a GET request because the library has not been loaded yet and does not stay reliably in the browser cache.

Is there a way to add a library to my application so that it gets cached along with my GWT application? The library consists of several folders, JS files, images, CSS, etc. My only idea is to dynamically create an Appcache manifest that dumps ALL files in the browser cache .. in this case I'm afraid of breaking the standalone functionality of GWT.

+3


source to share


1 answer


Yes, you can generate a manifest at compile time. Just use a linker that extends com.google.gwt.core.ext.linker.AbstractLinker.

See for example this example manifest manifest, or see Writing a GWT linker or see fooobar.com/questions/927925 / ...



I do this to enable google fonts and create a manifest that will only include the files for that particular language permutation.

+3


source







All Articles