Google Gadgets going cross-platform
November 29th, 2007 | Published in Google Code
For about two years now, people have been writing gadgets for Google Desktop on
Windows and for iGoogle on the web. Today, with the announcement of Google
Gadgets for Mac OS X, Google Desktop users on the Mac can now run the same
Windows and web-based gadgets in Apple's Dashboard with zero (or very few)
changes. Check it out for yourself.
Google Gadgets for the Mac uses WebKit's JavaScript engine inside Dashboard, so
the majority of gadgets just work if they're written properly. The rest can be
fixed by following a few guidelines:
- Use JavaScript, not JScript
-
- WebKit is case-sensitive, JScript is not, which can lead to problems if you assume can you do things like interchange SetTimeOut() and setTimeout().
- Avoid JScript-only features like collections and ActiveX.
- Avoid IE-specific DOM extensions, just as if you were writing a multi-browser web application.
- Avoid Windows-specific APIs
-
- You shouldn't assume ActiveX or certain DLLs are available. Neither WebKit nor Mac OS X supports ActiveX, so these gadgets must be rewritten.
- Avoid Windows-only APIs such as Google Talk. These APIs are not (yet) available on Mac OS X.
- Understand how Dashboard is different
-
- The Dashboard environment is very different from a web page or the Desktop sidebar on Windows in that it comes and goes as the user activates it. Don't rely on your gadget always being visible. Your gadget won't run or update when Dashboard isn't in the foreground.
- Don't rely on access to the file system. The security model for Dashboard doesn't allow arbitrary file access to the hard disk, although your gadget does have access to files in its own archive. Things like file pickers won't work. Note that while restricted file system access is a departure from how gadgets work on Windows, it's consistent with Dashboard's security model and the behavior of other widgets developed for Mac OS X.
For more details, see Writing a Cross-Platform Gadget, part of the Desktop Gadget API documentation.
If you're interested in developing your own gadget, visit the Gadgets API homepage. If you're already a gadget developer, download the beta today to test your gadget and ensure that it works correctly.