What you need to know about Chrome extensions

A browser action that shows unread messages.

A browser action that shows unread messages.

Extensions for Chrome are about to take off. The functionality has been in developer builds for a while, but Google is poised to bring it to all users.

1. Extensions are web apps

Extensions are ZIP packages with HTML, JavaScript, CSS and images inside. A JSON manifest tells Chrome what the extension does and what features it has.

2. What they can do

  • Edit page content (ad blocking!)
  • Use web APIs (through RSS, JSON etc.)
  • Add buttons and information to the toolbar
  • Open and close windows and tabs
  • Manage bookmarks

All access to tabs, windows and content is done through JavaScript APIs. Each extension is run isolated, and it cannot access other extensions or scripts that run on web pages.

3. What they can’t

  • Run arbitrary code
  • Add toolbars, sidebars, menu items etc.
  • Manage downloads, cookies, proxies etc.
  • Edit browser preferences

Note that future versions may have API hooks that do these. For now, extensions can’t touch the inner workings of the browser.

4. Browser and page actions

These are the two main types of UI for extensions. A browser action is a button that’s always visible. When clicked, it can open a new tab, show an info popup or do some other function. The button can change appearance and have an overlay badge like an unread count.

Page actions are the same, but the button only appears when necessary. This could be used for subscription buttons, for example.

5. Install without a restart

Click to install, enable/disable, update or uninstall. No restarts ever. For someone with a long Firefox background, this was quite the eye-opener.

6. Security model

Chrome isn’t a Firefox-like “extensions can do anything” system. Every extension must declare privileges it needs, like access to bookmarks or a specific domain. These are shown to the user when installing an extension.

7. Userscripts

Google provides a way to package existing Greasemonkey userscripts into Chrome extensions. In fact, userscripts are the way page content is manipulated in Chrome.

8. Background processes

If extensions are just JavaScript, how can you monitor ongoing events? An extension gets an invisible always-open page, where the JavaScript can keep on running.

9. Updates

Updates are fully automatic. An extension’s manifest contains an URL that Chrome listens to for future updates.

10. Gallery

Google already has a gallery for Chrome themes, and an extension one will open soon. Developers are invited to submit their extensions for the gallery.

Leave a comment