Friday, January 25, 2008

Google Gears API: Initialization

After installing Google Gears you can start using the Gears API. The first step would be the initialization of Gears, done using gears_init.js file. This file has an anonymous function call that creates a GearsFactory() object based on the browser. Google strongly recommends the initialization using gears_init.js file. Developers can use "google.gears" and "window.google" to check whether Gears is installed and properly initialized.

Refer below url for more details:
http://code.google.com/apis/gears/design.html#detecting

The anonymous function will be called when gears_init.js file is loaded directly using a script tag. Due to this when a page that loads gears_init.js file is accessed in IE7, below message will be popedup:

"This website wants to run the following add-on: 'gears.dll' from 'Google Inc ......."

However you could avoid this by encapsulating the initialization block with in a named function.

No comments: