Contents
Browser actions are buttons that are displayed in the main Chrome toolbar to the right of the omnibox.

Icons
Browser action icons can be up to 19px square. Larger icons will be resized to fit, but for best results, using a 19px icon is recommended.
Icons can be set two ways: using a static image or using the HTML5 canvas element. Using static images is easier for simple applications, but you can do more dynamic UIs using the canvas element.
Static images can be in any format WebKit can display. These include: png, bmp, ico, jpg, gif.
Badges
Browser actions can optionally display a badge, which is a bit of text that is layered over the icon. Badges make it easy to update the browser action to display a small amount of information about the state of the extension.
The badge APIs allow any length of text, but limiting badges to a max of four characters is recommended.
Popups
Popups allow browser actions to show additional UI when the user activates them. Popups contents are implemented using HTML and the popup is automatically sized to the content size.
Style Guide
For the best visual impact, we recommend observing the following guidelines:
- Do use browser actions for features that make sense on most pages.
- Don't use browser actions for features that only make sense for a few pages. Use page actions instead.
- Do use big, colorful icons that fully utilize the 19px square space. Browser action icons should seem a little bigger and heavier than page action icons.
- Don't attempt to mimic Chrome's monochrome "wrench" and "page" icons. This won't work well with themes, and anyway, extensions should stand out a little.
- Do use alpha transparency to add soft edges to your icon. Remember: many users theme Chrome, so your icon should look nice on a variety of background colors.
- Don't constantly animate your icon. That's just annoying.
Manifest
Developers declare their browser action using the following syntax:
"browser_action": { "default_title": "Google Mail", // Optional. Shown in tooltip. "default_icon": "images/icon19.png", // Optional. "popup": "popup.html" // Optional }
Note: Even if you don't include any of the values, you must include an empty browser_action entry in your manifest so that the system knows to reserve space for your browser action in the toolbar.
API reference: chrome.browserAction
Methods
setBadgeBackgroundColor
Sets the background color for the badge.
Parameters
-
details
( object )
- Undocumented.
-
-
color
( array of integer )
- An array of four integers in the range [0,255] that make up the ARGB color for the bakground of the badge.
-
color
Returns
setBadgeText
Sets the badge text for the browser action. This is printed on top of the icon.
Parameters
-
details
( object )
- Undocumented.
-
-
text
( string )
- Any number of characters can be passed, but only about four can fit in the space.
-
text
Returns
setIcon
Sets the icon for the browser action. The icon can be specified either as the index of one of the icons that was pre-specified in the manifest, or as the pixel data from a Canvas element. Either the path or the imageData property must be specified.
Parameters
-
details
( object )
- Undocumented.
-
-
imageData
( optional any )
- Pixel data for an image. Must be an ImageData object (eg from a
canvas
element). -
iconIndex
( optional integer )
- Deprecated. The zero-based index into the |icons| vector specified in the manifest.
-
path
( optional string )
- Relative path to an image in the extension to show in the browser action.
-
imageData
Returns
setTitle
Sets the title of the browser action. Shows up in the tooltip if the browser action is visible, and in the menu item.
Parameters
-
details
( object )
- Undocumented.
-
-
title
( string )
- The string the browser action should display when moused over.
-
title