We've been working on an offline capable JavaScript applicaion using Dojo and the storage and offline capabilities available in newer browsers.
The application is quite large, but it seems to load the larger files from the cache, and I can see that the application is in deed cached. Were using the applicationcache features, and there are no errors in the application cache as far as I and Chrome can see.
However we run into problems. Apparently Dojo cannot load its lanugage resources, nor the SMD file that describes the service we connect to.
These problems are highly visible on webkit-mobile, which is the targeted browser.
Any ideas to what might be wrong?
When you use off-line, (most likely mobile), most of the time you'll need an optimized build as well. You don't really want to offline a few dozen files.
I don't think XHR works offline, so any resource you load via XHR (that includes scripts, i18n bundles and other dynamically-loaded resources that are triggered via href) you should store into localStorage, and then branch off to load from loaclStorage instead of XHR when offline.
Now, you really need to be making an optimized build if you are running on the iPhone, iPad or an Android device. Also consider using the Closure Compiler to further optimize your build. See link below.
http://dojo-toolkit.33424.n3.nabble.com/file/n2636749/Using_the_Dojo_Toolkit_with_the_Closure_Compiler.pdf?by-user=t
The issue is that dojo does a few initalization XHR Requests. It goes online to fetch its localization bundle and any .smd files for the RPC feature.
XHR cannot access the offline applicationCache, even though the bundle and smd files are avaliable there they wont be found when Dojo asks for them.
An alternative is to leave them outside the manifest file, but that means dojo wont start offline anyway.
We fixed the issue with the .smd file by adding the service specification object located in the .smd file directly to the constructor of dojo.rpc.Service. This meant that dojo had all it needed and no longer had to fetch it.
The localization bundles was different. In the end I made sure that they were appended to the end of dojo.js, letting the dojo.provide statements take care of the rest. In essence I modified the build script (a bat file for us) to after building put the compacted localization bundle at the end of dojo.js.
Now dojo can start offline.
Have you seen this article at IBM? It seems to cover the issue you have.
Are you using a manifest file for an HTML5 application cache? If so, you need to explicitly list files and directories to cache. Like all other resources, your built localization bundles must be accounted for in your manifest, either in the CACHE section or in the NETWORK section