Work Offline With Google Gears
There are two distinct genres of applications that we use: online and offline. Historically, software packages were supposed to run off the hard-disk after running an installation or setup programme. Then came the web and offered sites like Hotmail allowing users to substitute mail programmes with an online alternative.
Since then, the race to port traditionally desktop managed applications to online browser-based versions has taken unprecedented pace. Now everything from e-mails, spreadsheets, word processors, presentations and even corporate tools like CRMs, ERPs, help desks, project management tools, all are available as online applications. But there is one limitations in these applications: they can only be used till home user is connected with the internet.
This limitation has obstructed wide-spread use of online office suites against the MS Office, since users in our country can neither afford to have an always on connectivity, nor the infrastructure allows it. So, to bridge this gap between online and offline functionality, Google has come up with a new technology called Google Gears that web enthusiasts term as truly revolutionary and groundbreaking.
Google Gears, allows existing web-based applications to support offline mode. One of the exciting examples of this technology is Google Reader, an online RSS news feed reader which can now download the feeds for offline viewing right in the browser interface - without having to download or install any specific programme.
Not only Google's own applications, but third-party solution providers such as, Zoho's web based word processor called Zoho Wirter offers the work offline facility. What this means is that, even though a user is using a browser-based application while connected to the internet, the programme will not cease to function when the connectivity is no longer there. Imagine having access to Gmail while offline, so that e-mails can be composed and sent when going online again.
Though a far fetched thought at this point in time, but it could very well be the ultimate goal of technologies like Google Gears. Because this is the only way for web application developers to pose a threat to the long standing dominance of desktop software giants such as Microsoft.
To get started with Google Gears, download it as a browser plug-in for either Internet Explorer or Firefox. As it supports all the major OS like Windows, Mac and Linux, trying it out should not be a problem.
Once installed, applications designed to take advantage of offline functionality automatically start to work seamlessly - except for two most common visual notifications. First is a link saying Go Offline - for example, Google Reader and Zoho Writer. Say you are using Zoho Writer in browser window, pressing Go Offline results in second indication - a dialogue box asking for permission to use Google Gears. This is extremely important from security point of view since giving an application authority to store data locally can cause havoc if in hands of malicious developers. So be sure whenever you press Allow. To control allowed and denied sites in Firefox, go to Tools > Google Gears Settings.
As an end-user, all we can do is to wait and see when online application companies make their products Google Gears enabled. But as a developer, you can start migrating your own website to take advantage of Gears. There is a full-fledged Developer's Guide available over Gear's official site along with Getting Started, that is
- Security plus Resources and Tools.
1. Data Layer and Synchronisation
Normally, a web-browser would talk directly to the web-server to fetch and update information shown to the user. Introduction of a data store between client (that is, browser) and server would mean that the client would make all its queries and requests to this data store instead of server which in turn would interact with the server. Or additionally, a data switch can be introduced between the client and data store and it is left up to this switch to decide when to fetch the data from the server, or when to refresh the server as new information is available (for example, user updates a document and auto-save has to be performed while online or offline).
This is how AJAX works, as data synchronisation with the server is no more necessary on every form submit or button press event as in the traditional web. And that is the power of Google Gears using which Remember The Milk, an online task management application, incorporated offline support in its service. Also, its important to decide ‘modality' that is, if there is going to be a user clicked go-offline function or the app would automatically detect disconnection an go-offline transparently, or a combination of both.
2. User of LocalServer, Database and WorkerPool
Depending upon the nature of application or website, the above three components of Google Gear can be used to create a rich user experience. LocalServer allows content to be kept at client side to speed things up, say by downloading and storing style-sheet CSS files. These are version controlled and updates are automatically updated. For data intensive sites, Gears data store in SQLite 3 format so that applications such as task managers and bookmarking sites can easily store, organise and retrieve customer data. Finally, WorkerPool can be used to introduce threading like capability to an application.
3. Offline Features
A lot depends upon nature of an application itself before deciding which features are to made available in offline mode. For example, downloading a customer's online bookmarks for local editing in bulk makes sense as compared to presenting the data in browser and requiring the user to press Submit every now and then. Similarly, processing-intensive search functionalities can be pushed at client side. That is why there should be a thorough analysis of all these architectural considerations for designing a new offline-supported app or adding this functionality in an already developed application.
The line separating online and offline state continues to get blurred and Google Gears is a giant step in this direction.