views:

484

answers:

4

I need to be able to run HTML forms offline. I mean they have to work without direct connection to the web server.

In an application I wrote over 5 years ago I did it by implementing a custom protocol handler - when a user initiated form submit the resulting HTTP request was recorded locally. At later time when a connection to the server becomes available a synchronization program loops through collected requests and submits them to the server collects the responses and again saves them locally for later use.

That was then. Now another customer approached me with a very similar request. What technology do you guys think I should use today?

Support for HTML5 is very limited just yet. Google gears? Or should I go back and continue using the protocol handler and custom synchronizer?

+2  A: 

Google Gears is a very good candidate - as an example, Google recently just announced that users would be able to attach files to emails while 'offline'. Another method might be to store the posted form data in a cookie, and when the user is able to get back online the server picks up the cookie and data with it.

Josh
A cookie will not cut it. The forms can have pretty significant amount of data, dozens of fields. I would not want to use cookies for it
mfeingold
I understand. However, keep in mind that cookies can store literally megabytes of data, depending on the browser. Even dozens of fields should not be an issue. Only issue will be with actual file data (i.e. PDF upload).
Josh
+3  A: 

I'd say go for HTML5. Not all browsers support it; but all will. In the meanwhile, i think it's better to say "to get offline features try such or such browser", instead of "please download this huge plugin with lots of scary warnings".

Also a simple demographics: HTML5 is in what, 5% of all browsers? 10%? still a lot more than the 0% of users with Gears already installed.

It's a real pity, thanks a lot Google for pushing the envelope with Gears; but in the wild the only plugin generally accepted is Flash. Fortunately, HTML5 is almost there already, with nearly the same features.

Javier
+1 for proposing a good long term solution
tosh
+1  A: 

Dojo.Storage/ Dojo Offline , has a flash bridge that will enable you to store data using flash's data store. The limit is user set, but starts at 5Mb. The library component is an abstraction, and also supports HTML 5, cookies, and gears.

Plus gears will allow you to store binary blobs, if memory serves.

Jonathan
+2  A: 

Rumors are running around that Google Gears is no longer under development. When you look at the gears features and issue tracker at http://code.google.com/p/gears/issues/list?can=2&q=&sort=version&colspec=Version%20Milestone%20Owner%20ID%20Summary%20Component for the new Gears development, there are only 3 items which will be fixed in version 0.6. Also, according to this Wikipedia article (http://en.wikipedia.org/wiki/Google_Gears), it seems that Google is not doing any development, and the open source project does not have a lot of steam either. Taken from the article is this:

"In late November 2009, numerous online news sources reported that Google is going to migrate to use HTML 5 rather than Gears in the future. A Google spokesman later clarified that Google will however continue to support Gears to not break sites using it."

In other words, Gears has been deprecated. Use HTML 5 instead.

Chad Rhyner