Are you getting weird behavior or odd errors while developing with Google Gears?

Posted On Jun 07, 2009 at 3:50 pm

Google Gears I spent at least four hours trying to debug a strange and passive bug in a Google Gears app I am working on. After picking apart a couple hundred lines of code and reducing the script to the absolute basic functionality of just a few lines, I was completely stupefied that I still had not found the source of the problem.

As a last, desperate resort, I started rearranging the placing of javascript includes. Well, it turns out that Gears will work, but have weird quirks if you initiate it via including the gears_init.js from within the head of the document. You must include gears_init.js from the body of the HTML document, not the head!

*Facepalm* Thanks Google for including that little important detail on the Gears website (or did I just not see it?).

In case it's relevant to your search, the web app I am working on involves drag-and-drop file uploads where you can drag any number of files from your computer into the browser and they will upload. The bug was that once I dropped in one set of files, and then a second, the getDragData would always return the first set of files, over and over again. I almost didn't even notice this bug!

This topic has the following tags: