Stopping the Gears


Last February, we let you know we were shifting our focus from Gears to HTML5. Over the last year or so, we’ve been working closely with other browser vendors and standards bodies to help define and standardize HTML5 features across browsers, and we’ve worked hard to improve these HTML5 capabilities in Chrome:


  • We implemented support for application caches, which are a great replacement for Gears’ offline features. App caches are already being used by web apps like the NYTimes app in the Chrome Web Store. There is also full-featured debugging support for application caches in Chrome’s developer tools.

  • Together with our friends at Mozilla and Microsoft, we proposed, specified, and implemented the IndexedDB API. This can take the place of the Gears Database API.

  • We implemented the HTML5 File API, which is very similar to the Gears Blob functionality.

  • We implemented the geolocation, notifications, and web worker APIs, which were pioneered by Gears, natively in Chrome.

With all this now available in HTML5, it’s finally time to say goodbye to Gears. There will be no new Gears releases, and newer browsers such as Firefox 4 and Internet Explorer 9 will not be supported. We will also be removing Gears from Chrome in Chrome 12.

The code itself will of course remain open source, and anyone is free to use it.

Our mission with Gears was to enable more powerful web applications. Over 5 releases, we added tons of APIs, enabling everything from offline access to parallel computation. Now that these features have all been adopted by browsers and have official W3C specs, they are available to more developers than we could have reached with Gears alone.

Edit: Corrected timeframe for removing Gears from Chrome.

Hello HTML5



If you've wondered why there haven't been many Gears releases or posts on the Gears blog lately, it's because we've shifted our effort towards bringing all of the Gears capabilities into web standards like HTML5. We're not there yet, but we are getting closer. In January we shipped a new version of Google Chrome that natively supports a Database API similar to the Gears database API, workers (both local and shared, equivalent to workers and cross-origin wokers in Gears), and also new APIs like Local Storage and Web Sockets. Other facets of Gears, such as the LocalServer API and Geolocation, are also represented by similar APIs in new standards and will be included in Google Chrome shortly.

We realize there is not yet a simple, comprehensive way to take your Gears-enabled application and move it (and your entire userbase) over to a standards-based approach. We will continue to support Gears until such a migration is more feasible, but this support will be necessarily constrained in scope. We will not be investing resources in active development of new features. Likewise, there are some platforms that would require a significant engineering effort to support due to large architectural changes. Specifically, we cannot support Gears in Safari on OS X Snow Leopard and later. Support for Gears in Firefox (including 3.6, which will be supported shortly) and Internet Explorer will continue.

Looking back, Gears has helped us deliver much-desired functionality, such as the ability to offer offline access in GMail, to a large number of users. Long term, we expect that as browsers support an increasing amount of this functionality natively and as users upgrade to more capable browsers, applications will make a similar migration. If you haven't already, you will want to take a look at the latest developments in web browsers and the functionality many now provide, reach out with questions, and consider how you can use these in your web applications. Gears has taken us the first part of the way; now we're excited to see browsers take us the rest of the way.

Gears 0.5.21.0 Released




In conjunction with Google I/O we're releasing a new version of Gears, 0.5.21.0. This version includes minor bugfixes and three new features:
  • Drag & Drop support for dragging files into a web page and letting the web page act on those files
  • Image thumbnailing
  • Blob builder API, which allows script to build binary blobs, including valid multi-part-form-encoded blobs that contain binary file parts, which can then be uploaded using Gears.HttpRequest
Documentation on http://code.google.com/apis/gears/ will be updated soon with more details about the new features.

WiFi-based geolocation, anyone?




Guess what? The Gears Geolocation API got even better! We have just released a new version of Gears, 0.4.24.0, which contains an enhanced implementation of the Geolocation API. This new version uses WiFi access point signals to return significantly more accurate results, making it a lot more useful on laptop computers.

You can find more details about this release on the UK Google Code Blog.

Gears For Safari




We're really excited to announce the official release of Gears for Safari on OS X (minimum requirements are Leopard 10.5.3 or Tiger 10.4.11).

You can download it today from http://gears.google.com.

This means that you can now access all the Gears-enabled sites (such as Zoho office, WordPress, the new YouTube uploader and Google Docs offline) in Safari.

Since launch, we've increased the number of APIs available in Gears. The 0.3 release added the ability to create desktop shortcuts for websites, and the 0.4 release added Geolocation and Blobs (useful for resumable uploads of large files). All of these are now available in Safari and work exactly the same as on the other browsers Gears supports.

We thought it might be interesting to talk about some of the technical aspects of Gears peculiar to Safari and OS X. If you aren't a developer you can safely skip the following paragraphs and go straight to the download page.

When you install Gears, you'll notice that it's composed of 2 components: an NPAPI plugin which lives in "/Library/Internet Plugins" and an InputManager. Gears needs to load first thing upon browser startup, for cases in which the first page loaded into the browser is from the Gears offline cache. NPAPI provides no mechanism for loading that early (it only provides support for loading plugins the first time a page specifically includes them) so we needed a small InputManager to do the work for us.

For browsers other than Safari that use the WebKit engine, we've provided a really simple mechanism to allow them to load Gears into their program without using the InputManager. Fluid is one example of a 3rd party browser that supports Gears this way.

On the Mac, Gears desktop shortcuts are actually small applications that are designed to open the website in the same browser they were originally created from. This means that if you created them from a Fluid app they'll open in that same place and if you've got multiple versions of Firefox installed on your machine the shortcut will open in the right one.

We hope you've found this post interesting. If you have any feedback we'd love to hear from you on our mailing list.

Gears 0.4 is here!




But where exactly is 'here'? Well, that's a question that takes on a whole new meaning with this new release of Gears: we have added a new Geolocation API, which allows you to build applications that can do new and exciting things based on your users' location. You can query Gears for the user's current location using the getCurrentPosition() method or you can ask Gears to notify you every time the location changes, using the watchPosition() method. Of course, we take privacy issues very seriously, which is why we have a special permission dialog that allows users to decide which Web sites should have access to their location information. If you want to learn more about how the Geolocation API works, please see the Google Code blog post.

Another cool new feature is the Blob API. Unlike strings, blobs let you reference arbitrary binary data — a first for JavaScript! Therefore, blobs can more naturally represent things like files and images, and they can be passed around efficiently. We have updated several existing APIs to work with blobs, such as WorkerPool sendMessage() and HttpRequest send(). And that's not all! We have also extended the Desktop API with a new method, openFiles(), which allows users to select multiple files of a particular content type, and then returns them as blobs for easy uploading or worker processing.

Other major changes in Gears 0.4 include:

For the full list of changes, you can check out the Gears API history.

If you are a developer anxious to try these new APIs, first check gears.google.com to make sure you have Gears 0.4 installed (your browser should be updated automatically) and then browse the Gears documentation pages. If you are a mobile developer, please make sure you also read our Google Mobile blog post to learn more details about what devices support the Geolocation API.

Finally, an update on how we are doing on Web standards: in line with our earlier promises, the Geolocation API is a W3C Editor's draft and its current design is a result of open collaboration with many other people and organizations. We plan to continue to drive this standardization effort, as well work with the community on new Web standards.

Gears Best Practices


Have fun!

Creating a Client-Side Search Engine With Gears




I've posted an in-depth article and tutorial on creating a client-side search engine with Gears. Here's a short snippet from the article:

Did you know that you can use Gears to do fast, client-side searching of data, similar to a client-side search engine? Gears bundles Full-Text Search (FTS) abilities right into its local, SQLite database. MySpace, for example, uses this feature with their MySpace Mail application, downloading all of a user's messages for fast, client-side search. Because all of the data is local, you can do nifty things like search over the data in real-time as the user types, something that is much harder if you have to query over the network to a server to do the searching.

Would you like to add the same kind of fast, local searching to your own web page and web applications? This article introduces you to PubTools Search and the Gears features that power it, namely Full-Text Search and Workers. PubTools Search is an open source JavaScript library that drops a client-side search engine right into your page. You configure it with basic HTML plus a list of URLs to index. Once loaded, a search form that uses the local Gears full-text search abilities will appear in your page to quickly and locally search over the documents in real time as a user types into the search field.

Please note that PubTools Search is not an official Google project or Gears API; it is a project I created on my own to teach and help developers. The Gears team does not support this project.

The article covers the following:

  • An introduction to Gears' Full-Text Search and Worker features
  • How to drop PubTools Search into your page to quickly get going
  • Deep walkthrough and dissection of how PubTools Search works internally with source code and snippets so you can use these Gears features in your own applications
  • An introduction to parts of the Dojo toolkit used in PubTools Search, using actual source from PubTools Search including a discussion on some of the techniques used in modern JavaScript development
  • Tips and tricks when working with Gears

Read the full article and try the demo yourself!

Speeding Up WordPress With Gears




WordPress.com just recently went live with Gears support for accelerating the user-interface, and the upcoming WordPress 2.6 release will also bundle Gears.

Andrew Ozz, a member of the WordPress team and the person responsible for the Gears integration wrote the following guest post on his experience working with Gears:

I thoroughly enjoyed working with Gears. After checking the excellent API documentation and examples, the test implementation of a ManagedResourceStore in WordPress was ready to go in about an hour.

After that I only had to refine the various status messages and user prompts and the first step of implementing Gears support in WordPress was ready for public testing. That was the fastest and easiest integration with another open source software I've had the opportunity to contribute to.

Currently WordPress implements Gears support in a somewhat "non-traditional" way. It uses only the local storage to cache all static files from the admin interface on the user's computer, eliminating needless requests to the server and improving page load speed, quite significantly in some cases.

Some of the limitations of this are that Gears prompts for permission on each sub-domain, so when a user has several blogs on WordPress.com, it will have to be enabled for each separately. Another is that although all files are served from the local storage in SSL mode, the browser reports that the web page is partially encrypted.

The Gears support is already live on WordPress.com, and is included in the next version of the self-hosted WordPress, that is due in a few days.


In my opinion Gears is more than an easy way to enable online applications to work offline. It extends the web browser into an OS independent application development platform. I won't be surprised to see some very different web enabled desktop applications built with it.

Flexi-ng your muscles with Gears




When a lot of developers think about Flex, they often tie it to Flash and AIR, but you can of course integrate Flex applications with many other front-end services.

Mrinal Wadhwa has seen value in building Flex applications, and also likes functionality available in Gears.

He wrote up an article on enhancing Flex applications with Gears which had him create a sample application the uses the Desktop API in Gears.

It is interesting to take a look at the source to see how Flex applications tie back to plain old JavaScript.

For example, the following shows you how you put JavaScript into your Flex application, and then call back to the Flex code via thisMovie(APP_NAME).methodToCall:
<JavaScript>
// tells the swf if gears is installed
function isGearsInstalled() {
if (window.google && google.gears) { //gears is installed
thisMovie("FlexGears").testForGears(true);
return;
}
//gears is not installed
thisMovie("FlexGears").testForGears(false);
}


function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
// ....
</JavaScript>
Thanks to Mrinal Wadhwa for taking the time to try this all out. We enjoy seeing how people take Gears into many corners of the Web!

Also, you may not have seen QuickFix, an example application that shows how you can use Flex to talk to Google App Engine. The example is created by Dick Wall from App Engine, and James Ward from Adobe.

Gears Sessions from Google I/O are now available to watch






We had a great time at Google I/O at the end of May, and there were plenty of Gears-related content. Fortunately, video cameras were at the ready, and all of the sessions have been published on YouTube.

I put together a playlist (embedded player above) of the Gears content which includes:Also, you may be interested in other Ajax related content such as:

GWT

General Ajax

Fly, Gears 0.3!




Well, that's it, Gears 0.3 has officially left the nest. Most users have now been updated to 0.3.24.0. If you haven't, you can update at gears.google.com.

It seemed like just yesterday we were announcing 0.2. But here we are again, with great new features like:
*Sniff* ... They grow up so fast.

As always, please let us know what you think of the new APIs, and what you think still needs work. Or better yet, join the project and send us a patch.

And don't worry about us, we'll be fine. We've got to focus on 0.4. Soon enough, it too will spread its wings.

Appcelerator gives you Gears functionality out of the box




Jeff Haynie announced that the latest Appcelerator SDK supports Gears.

First, for those that haven't heard of Appcelerator, it is an open source "RIA" development toolkit that focuses on rich clients talking to services on the backend. You can think of it somewhat as a Flex-like framework built with Open Web technology.

We are seeing an interesting trend. At first, frameworks would wrap Gears semantics in something that makes sense for their audience of developers, which is great.

Appcelerator though does something a little different. It uses Gears under the hood to make your existing Appcelerator based application a better user experience.

This is what they say:
With the next release of the SDK, Appcelerator's javascript servicebroker will now automagically (and transparently) switch to using a Gears-enabled servicebroker when talking to your service-backend. That means your application will perform faster because the AJAX communication between client and server (especially for apps using fast polling) will be out-of-process using Gears' worker pool.

You have to do nothing to enable this in your application. When you Appcelerator application loads, a small piece of code will check to see if Gears is enabled and will dynamically load the gears-enabled servicebroker code.
I am looking forward to seeing applications that use this in the wild.

In other news, they also wrote up a nice post on how you can use Appcelerator and App Engine in a very simple way.

MySpace Message Center is now searching with Gears




MySpace announced new functionality into their MySpace Message Center today at Google I/O.

One feature that they were lacking was the ability for MySpace users to actually search their MySpace messages. To go through mail, users have to page through all of their messages until their find the right one. Not optimal to say the least!

They could have tried to do search on the server side, but it can be a very expensive operation, and when you are at MySpace scale, you have to choose your battles.

With server side search out, they looked at doing the work on the client. They ended up with a Gears powered solution that not only searches, but gives back results in real-time as you are typing it in. This means that you can stop typing earlier, as you find what you are looking for.

The MySpace team has been a pleasure to work with, and were very fast to put the pieces together of an Full Text Search datastore, and the WorkerPool to offload the search without hanging the browser. As I type this Owyn Richen is going over the details of the implementation at his Google I/O session.

We are excited to see them launch, and look forward to seeing what else they come up with!

New Gears and AJAX sessions posted for Google I/O





Google I/O is just a few weeks away (May 28 - 29). If you haven't already, don't forget to register for the event. We now have over 80 sessions posted, including a number of new sessions on Gears and AJAX technologies, including:

Taking Large-Scale Applications Offline - Lessons Learned from Google Docs
With the release of Google Docs offline, we asked the team if they could provide developers with some lessons learned. Google engineer Steve Saviano will explain the challenges that his team faced taking Google Docs offline with Gears and how they overcame them.

Gears and MySpace - an Exploration of Powering Search on the Client
Owyn Richen of MySpace will discuss their thoughts on using Google Gears to provide data-intensive features like adding search to their mail system.

HTML5, Brought to You by Gears
Aaron Boodman, whom many of you know as part of the core Gears team and also from Greasemonkey fame, will be talking about how the Google Gears mission relates to future web standards like HTML5.

Can We Get There From Here?
Alex Russell, co-creator of The Dojo Toolkit, looks at the state of the web development stack and the differing views and approaches to advancing development within a browser.

Improving Browsers in New Ways: Gears++
Chris Prince, also known in the UK as the Gears engineer with the best beard, will give a sneak peek at what's coming in Gears. You may be surprised that *none* of the features are related to offline. Rather, they fall under the broader Gears vision of improving web browsers.

Be sure to visit the website to see the complete list of sessions and to register. For those coming from out of town, we've arranged discounted room rates at nearby hotels. Read the details on the website to take advantage of the discount.

Gears and Standards




Gears is about more than just offline web applications. For example, we recently added desktop shortcut functionality, and we're working on resumable uploads, a geolocation API, and lots more fun things for the future.

We've received some questions recently about how all this relates to web standards, such as HTML5 and those proposed by the W3C. It seems like some people are afraid Gears will try to compete with the web.

Let us put those fears to rest right now: on the Gears team we loves us some web standards. Some of us were web developers stuck in the crossfire of the browser wars, and we deeply understand standards have played a key role in the productivity and creativity of the web over the past 10 years.

We have no desire to create a parallel platform and compete with the web. Anyway, that would be crazy. The web is an unstoppable force of nature. Competing with it would be like entering a shouting match with the wind: you can't win, and you look pretty silly trying.

Instead, Gears aims to bring emerging web standards to as many devices as possible, as quickly as possible.


Some History

The Gears project started because a group of developers at Google were frustrated by the slow march of web browsers. Competition and standards were producing fantastic results, but it took a long time to get implementations on every browser. In some cases, we still don't have compatible implementations, years after the standards were finalized. Our first project was to implement APIs that would make offline web applications possible.

Currently, the Gears Database and LocalServer modules are not fully compatible with the HTML5 proposals for the same functionality. This is only because those specs were written after Gears was released, and not because of any desire to be different. In fact, we were involved in the design of both HTML5 specs, and we are currently implementing the proposal for database access.


Going Forward

In many ways, Gears is like a browser without any UI. And just like other browsers, Gears will implement existing standards and rally for changes and additions where they seem needed. For example, we recently proposed our geolocation API work to the W3C WebAPI group.

There are three important differences between Gears and other browsers, however:
  1. Improvements to Gears can be used by developers immediately. Gears is available today on Firefox (for Windows, OS X, and Linux), IE, and IE Mobile. Implementations for more browsers and platforms are in progress. Developers no longer have to wait for every browser to implement new web standards before they can use them, they only have to wait for them to be available on Gears.

  2. Most browser vendors have two groups of customers: users and developers. User-facing features typically get more attention than developer-facing APIs, for a variety of reasons. But with Gears, developers are the only customers. We can focus completely on creating the best possible platform for web development.

  3. Gears is an implementation of web standards that lives inside another browser. For example, the HTML5 Database API might be available to developers through both the google.gears object and the traditional window object. This is OK, and in some ways a good thing. Developers will be able to mix and match the pieces of Gears and native browser implementations that work best.

The Pitch

By implementing emerging web standards, Gears is influencing what the web of tomorrow will look and act like. And since Gears is an open source project, anyone can contribute.

Get involved. You don't have to be able to code in C++. All that's needed is some free time and the desire to push the web forward.

What's new with Google Gears? A Tech Talk




Brad Neuberg and Ben Lisbakken of the Gears team gave a brown bag talk on some of the new and interesting features in Gears.

They show a lot of examples and tools such as:
  • PubTools: Brad developed this set of tools to enable offline caching of content in minutes. This is perfect if you have a set of content that you want to make available offline.

  • Google Gears for Mobile: Just yesterday we launched our first Google mobile application using Gears, with Picasa

  • Cross Domain Web Services: A good example using Flickr search

  • Dojo Storage has just had a new release so it plays in the new Dojo 1.x land, and has a Gears storage engine

  • blog.gears: Pamela Fox did a great job with this GData/Gears blogging application

  • Gears + Greasemonkey = GearsMonkey

It is fun to hear some of the fellow Googlers probe with their own questions!



Brad and Ben will both be at Google I/O, May 28-29, 2008, in San Francisco. We are keen to hear your thoughts on Gears and the Open Web.

This is not an April Fool's joke!




As of yesterday, it is possible to use Google Docs offline. We've all been working on this for a while now, and I think sometimes we take it for granted. A web-based word processor you can use without an internet connection?! Who'd'a thunk it?

Gigantic congrats to the Docs team, from all of us working on Gears. We especially love how simple you have made the setup and synchronization process.

Sometime soon, we'll have to get one of the Docs engineers to write a blog post about some of the challenges they faced bringing this together. There are some really interesting stories and lessons in there that would be useful to anyone aiming to offline-enable their web application.

To see offline Docs in action, check out the video below.

Gears Screencast: An Introductory Tutorial




Using a JavaScript API to cache web pages offline, interact with a client side database and introduce threading into your application isn't immediately intuitive because it's such a foreign concept for a web API. I remember when I was doing my first work with Gears -- I was a bit disoriented and in need of a walk through of how things work and why.

To help potential Gears users that feel like my 7-month-ago-self, I wrote a tutorial application that uses a minimal amount of non-Gears code. This application is a simple stock ticker that makes use of 5 of the Gears modules; LocalServer, Database, WorkerPool, Timer, and HTTPRequest.

But a standalone application can't teach someone -- it needs some explaining. Long articles generally lose my attention, so my media of choice was video. I made a screen cast where I walk through the code in three steps, which you can find here. There's also a zip file that contains the three steps of code so you can take a look at the code on your own. Please note that there is a PHP file that is required for the application to work, so you will need a server that runs PHP in order to use this code on your own!

Joose.Gears: Adding support for workers in a self-hosting meta object system




Malte Ubl, who brought us xssinterface, has a new project that has Gears support.

Joose is a self-hosting meta object system for JavaScript inspired by the Perl Moose. Joose supports inheritance, traits, mixins, method wrappers and more.

Where Gears comes into the mix is through the Joose.Gears meta class which enables automatic delegation of methods to be executed as a Gears worker. If Gears is not present, the worker is executed in the main thread. The workers result will be sent to a method called "on".ucfirst($worker_name) if available:

Class("HardWork", {
meta: Joose.Gears,
has: {
data: {is: rw, init: {}}
},
methods: {
onDoWork: function (result) {
ok(result == 1001, "Gear Worker returns correct result")
}
},
workers: {
doWork: function (start) {
var counter = start;
for(var i = 0; i < 1000; i++) {
counter++
}
return counter
}
}
})

var hw = new HardWork();

hw.doWork(1)
You can take a peak at the innards to see another interesting use of Gears.