このページは大阪弁化フィルタによって翻訳生成されたんですわ。

翻訳前ページへ


chrome.infobars - Google Chrome
The Wayback Machine - http://web.archive.org/web/20130824101454/http://developer.chrome.com/extensions/infobars.html

chrome.infobars

This API is experimental. It is only available to Chrome users on the dev channel.

Description: Use the chrome.infobars API to add a horizontal panel just above a tab's contents. See the screenshot below.
Availability: Dev channel only.
Permissions: "infobars"

The infobars API allows you to add a horizontal panel just above a tab's contents, as the following screenshot shows.

An infobar asking whether the user wants to translate the current page

Use an infobar to tell the reader something about a particular page. When the user leaves the page for which the infobar is displayed, Google Chrome automatically closes the infobar.

You implement the content of your infobar using HTML. Because infobars are ordinary pages inside an extension, they can communicate with other extension pages.

Manifest

The infobars API is avaiable under "infobars" permission and dev channel only. Also, you should specify a 16x16-pixel icon for display next to your infobar. For example:

{
  "name": "Andy's infobar extension",
  "version": "1.0",
  "permissions": ["infobars"],
  "icons": {
    "16": "16.png"
  },
  "background": {
    "scripts": ["background.js"]
  }
}

chrome.infobars reference

Methods

show

chrome.infobars.show(object details, function callback)

Shows an infobar in the specified tab. The infobar will be closed automatically when the tab navigates. Use window.close() to close the infobar before then.

Parameters

details ( object )
tabId ( integer )
The tab id for the tab to display the infobar in.
path ( string )
The html file that contains the infobar.
height ( optional integer )
The height (in pixels) of the infobar to show. If omitted, the default infobar height will be used.
callback ( optional function )

Callback

If you specify the callback parameter, it should specify a function that looks like this:

function(windows.Window window) {...};
window ( windows.Window )
Contains details about the window in which the infobar was created.

Sample Extensions that use chrome.infobars

  • SandwichBar – Shows an infobar on pages which contain the word 'sandwich'