

Specify the HTML file in the default_popup field of browser_action in the manifest, or call the tPopup method. To add a popup to your browser action, create an HTML file with the popup's contents. The popup cannot be smaller than 25x25 and cannot be larger than 800圆00. The popup can contain any HTML contents that you like, and it's automatically sized to fit its contents.

If a browser action has a popup, the popup appears when the user clicks the extension's icon. Set the text and color of the badge using tBadgeText and tBadgeBackgroundColor, respectively. Badges make it easy to update the browser action to display a small amount of information about the state of the extension.īecause the badge has limited space, it should have 4 characters or less. # Badgeīrowser actions can optionally display a badge-a bit of text that is layered over the icon.

You can specify locale-specific strings for the default_title field see Internationalization for details. To set the tooltip, use the default_title field of browser_action in the manifest, or call the tTitle method. The icon set can contain any size icon specification, and Chrome will select the most appropriate one. The actual image to display will be selected from the set to best fit the pixel size of 16 dip. To properly display icon when screen pixel density (ratio size_in_pixel / size_in_dip) is different than 1, the icon can be defined as set of images with different sizes. To set the icon, use the default_icon field of browser_action in the manifest, or call the tIcon method. For unpacked extensions, images must be in the PNG format. Static images can be in any format WebKit can display, including BMP, GIF, ICO, JPEG, or PNG. Using static images is easier for simple applications, but you can create more dynamic UIs-such as smooth animation-using the canvas element. You can set the icon in two ways: using a static image or using the HTML5 canvas element. Larger icons are resized to fit, but for best results, use a 16-dip square icon. The browser action icons in Chrome are 16 dips (device-independent pixels) wide and high. Register your browser action in the extension manifest like this: Ī browser action can have an icon, a tooltip, a badge, and a popup. If you want to create an icon that isn't always active, use a page action instead of a browser action. In the following figure, the multicolored square to the right of the address bar is the icon for a browser action.
