# 標簽
chrome標簽模塊被用于和瀏覽器的標簽系統交互。此模塊被用于創建,修改,重新排列瀏覽器中的標簽。.

## Manifest
幾乎所有chrome標簽方法需要你在[extension manifest](manifest.html)中定義標簽權限。例如:
```
{
"name": "My extension",
...
**"permissions": [
"tabs"
]**,
...
}
```
不需要"標簽"權限的方法是:[create](#method-create) 和 [update](#method-update).
## 示例
你可以在[examples/api/tabs](http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/tabs/) 目錄下找到運用標簽模塊的示例。在源代碼中查看幫助或者示例,請查閱[Samples](samples.html)
。
## API reference: chrome.tabs
### Properties
<a></a>
#### getLastError
chrome.extensionlastError
### Methods
#### captureVisibleTab
void chrome.tabs.captureVisibleTab(, integer `windowId`, object `options`, function `callback`)
Undocumented.
在特定窗口中,抓取當前選中標簽的可視區域。 這要求必須在 [host permission](manifest.html#permissions) 中指定對標簽URL的訪問權限。
#### Parameters
`windowId`_( optional enumerated Type array of integer )_
Undocumented.
目標窗口,默認值為[當前窗口](windows.html#current-window).
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`options`_( optional enumerated Type array of object )_
Undocumented.
設置抓取圖像參數。設置圖像抓取的參數,比如生成的圖像的格式。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`format`_( optional enumerated Type array of string ["jpeg", "png"] )_
Undocumented.
生成的圖像的格式。默認是jpeg。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`quality`_( optional enumerated Type array of integer )_
Undocumented.
如果格式是'jpeg',控制結果圖像的質量。此參數對PNG圖像無效。當質量降低的時候,抓取的畫質會下降,需要存儲的字節數也會遞減。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### Callback function
回調 _參數_ 應該如下定義:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(string dataUrl) {...};
```
`dataUrl`_( optional enumerated Type array of string )_
Undocumented.
被抓取標簽的可視區域的URL。此URL可能會作為圖像的src屬性。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### connect
Port chrome.tabs.connect(, integer `tabId`, object `connectInfo`)
Undocumented.
連接到特定標簽中的content script(s)。 事件 [chrome.extension.onConnect](extension.html#event-onConnect) 將被觸發給每個指定頁面上運行的content script擴展。了解更多請查看 [Content Script Messaging](content_scripts.html#host-page-communication)。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`connectInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`name`_( optional enumerated Type array of string )_
Undocumented.
會被傳輸到監聽連接事件的content scirpt的onConnect函數當中。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
`paramName`_( optional enumerated [Port](extension.html#type-Port) array of paramType )_
Undocumented.
可以和在指定標簽中運行的內容腳本通信。當標簽被關閉或者不存在時,端口的 [onDisconnect](extension.html#type-Port) 事件被觸發。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Callback function
The callback _parameter_ should specify a function that looks like this:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(Type param1, Type param2) {...};
```
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### create
void chrome.tabs.create(, object `createProperties`, function `callback`)
Undocumented.
創建新的標簽。注: 無需請求manifest的標簽權限,此方法也可以被使用。
#### Parameters
`createProperties`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`windowId`_( optional enumerated Type array of integer )_
Undocumented.
創建新標簽的目標窗口。默認是[當前窗口](windows.html#current-window) 。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`index`_( optional enumerated Type array of integer )_
Undocumented.
標簽在窗口中的位置。 值在零至標簽數量之間。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`url`_( optional enumerated Type array of string )_
Undocumented.
標簽導航的初始頁面。完整的URL 必須包含一個前綴 (如 'http://www.google.com', 不能寫為 'www.google.com')。 相對 URL則與擴展所在的頁面相對, 默認值為新標簽頁面。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`selected`_( optional enumerated Type array of boolean )_
Undocumented.
標簽是否成為選中標簽。默認為true。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`pinned`_( optional enumerated Type array of boolean )_
Undocumented.
標簽是否被固定。默認值為false。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### Callback function
The callback _parameter_ should specify a function that looks like this:
回調 _參數_ 應該如下定義:
```
function(Tab tab) {...};
```
`tab`_( optional enumerated [Tab](tabs.html#type-Tab) array of paramType )_
Undocumented.
所創建的標簽的細節,包含新標簽的ID。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### detectLanguage
void chrome.tabs.detectLanguage(, integer `tabId`, function `callback`)
Undocumented.
檢測標簽內容的主要語言。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
默認為"[當前窗口](windows.html#current-window)"所選定的標簽。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### Callback function
回調 _參數_ 應該如下定義:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(string language) {...};
```
`language`_( optional enumerated Type array of string )_
Undocumented.
ISO 語言編碼,例如en 或者 fr。若要查看此方法支持的完整語言列表,請參閱[kLanguageInfoTable](http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc) 。第2列和第4列會被檢測,而且第一個不為空的值會被返回。 簡體中文是個例外,返回zh-CN。對于未知語言,返回und。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### executeScript
void chrome.tabs.executeScript(, integer `tabId`, object `details`, function `callback`)
Undocumented.
向頁面注入JavaScript 腳本執行。要了解詳情,請查閱內容腳本文檔的 [programmatic injection](content_scripts.html#pi) 部分。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
運行腳本的標簽ID;默認為當前窗口所選中的標簽。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`details`_( optional enumerated Type array of object )_
Undocumented.
要執行的腳本內容,可選code或者file,但不能同時選兩者。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`code`_( optional enumerated Type array of string )_
Undocumented.
要執行的腳本代碼。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`file`_( optional enumerated Type array of string )_
Undocumented.
要執行的腳本文件。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`allFrames`_( optional enumerated Type array of boolean )_
Undocumented.
true的時候,給所有frame執行腳本。默認為false,只給頂級frame執行腳本。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
所有腳本執行后會被調用的回調。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### Callback function
The callback _parameter_ should specify a function that looks like this:
回調 _參數_ 應該如下定義:
```
function() {...};
```
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### get
void chrome.tabs.get(, integer `tabId`, function `callback`)
Undocumented.
獲取指定標簽的細節信息。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回調函數
回調 _參數_ 應該如下定義:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(Tab tab) {...};
```
`tab`_( optional enumerated [Tab](tabs.html#type-Tab) array of paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### getAllInWindow
void chrome.tabs.getAllInWindow(, integer `windowId`, function `callback`)
Undocumented.
獲取指定窗口所有標簽的細節信息。
#### Parameters
`windowId`_( optional enumerated Type array of integer )_
Undocumented.
默認為[當前窗口](windows.html#current-window)。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回調函數
T 回調 _參數_ 應該如下定義:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(array of Tab tabs) {...};
```
`tabs`_( optional enumerated Type array of [Tab](tabs.html#type-Tab) array of paramType paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### getCurrent
void chrome.tabs.getCurrent(, function `callback`)
Undocumented.
獲取生成腳本調用的標簽。此函數不適用于腳本被非標簽內容調用的情況。(例如: 背景頁 或者 彈出視圖) 。
#### Parameters
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回調函數
回調 _參數_ 應該如下定義:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(Tab tab) {...};
```
`tab`_( optional enumerated [Tab](tabs.html#type-Tab) array of paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### getSelected
void chrome.tabs.getSelected(, integer `windowId`, function `callback`)
Undocumented.
獲取特定窗口指定的標簽。
#### Parameters
`windowId`_( optional enumerated Type array of integer )_
Undocumented.
默認為[當前窗口](windows.html#current-window)。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回調函數
回調 _參數_ 應該如下定義:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(Tab tab) {...};
```
`tab`_( optional enumerated [Tab](tabs.html#type-Tab) array of paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### insertCSS
void chrome.tabs.insertCSS(, integer `tabId`, object `details`, function `callback`)
Undocumented.
向頁面注入CSS。要了解詳情,請參閱內容腳本文檔中的 [programmatic injection](content_scripts.html#pi) 部分。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
要注入CSS的標簽ID;默認為當前窗口選定的標簽。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`details`_( optional enumerated Type array of object )_
Undocumented.
要注入的CSS的內容,可選code或者file,但不能同時選兩者。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`code`_( optional enumerated Type array of string )_
Undocumented.
要注入的CSS代碼。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`file`_( optional enumerated Type array of string )_
Undocumented.
要注入的CSS文件。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`allFrames`_( optional enumerated Type array of boolean )_
Undocumented.
true的時候,給所有frame注入CSS。默認為false,只給頂級frame注入CSS。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
當所有的CSS 被注入后,回調被調用。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回調函數
回調 _參數_ 應該如下定義:
```
function() {...};
```
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### move
void chrome.tabs.move(, integer `tabId`, object `moveProperties`, function `callback`)
Undocumented.
把標簽移動至窗口內特定的位置,或者移至一個新窗口。請注意只能在普通窗口之間切移(window.type === "normal") 。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`moveProperties`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`windowId`_( optional enumerated Type array of integer )_
Undocumented.
默認為標簽所在的窗口。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`index`_( optional enumerated Type array of integer )_
Undocumented.
移動到的目標窗口位置。賦值必須在零至目標窗口的標簽數目之間。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回調函數
回調 _參數_ 應該如下定義:
```
function(Tab tab) {...};
```
`tab`_( optional enumerated [Tab](tabs.html#type-Tab) array of paramType )_
Undocumented.
所被移動的標簽細節。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### remove
void chrome.tabs.remove(, integer `tabId`, function `callback`)
Undocumented.
關閉標簽。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回調函數
回調 _參數_ 應該如下定義:
```
function() {...};
```
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### sendRequest
void chrome.tabs.sendRequest(, integer `tabId`, any `request`, function `responseCallback`)
Undocumented.
向特定的標簽content script發送一個的請求, 并在響應返回時,可附帶一個回調。在所有content script響應請求后, [chrome.extension.onRequest](extension.html#event-onRequest) 事件將會為當前擴展觸發。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`request`_( optional enumerated Type array of any )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`responseCallback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
##### Parameters
`response`_( optional enumerated Type array of any )_
Undocumented.
響應的JSON對象。如果錯誤發生,回調將不會有參數。并會在 [chrome.extension.lastError](extension.html#property-lastError) 產生一個錯誤。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回調函數
回調 _參數_ 應該如下定義:
```
function(any response) {...};
```
`response`_( optional enumerated Type array of any )_
Undocumented.
響應的JSON對象。如果錯誤發生,回調將不會有參數。并會在 [chrome.extension.lastError](extension.html#property-lastError) 產生一個錯誤。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### update
void chrome.tabs.update(, integer `tabId`, object `updateProperties`, function `callback`)
Undocumented.
修改標簽的屬性。沒有在updateProperties 中指定的屬性不會被修改。注:即使沒有向manifest 請求'tabs'權限,這個方法依然適用。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`updateProperties`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`url`_( optional enumerated Type array of undefined )_
Undocumented.
讓標簽瀏覽的URL。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`selected`_( optional enumerated Type array of boolean )_
Undocumented.
標簽是否應被選中。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`pinned`_( optional enumerated Type array of boolean )_
Undocumented.
標簽是否應被固定。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回調函數
The callback _parameter_ should specify a function that looks like this:
回調 _參數_ 應該如下定義:
```
function(Tab tab) {...};
```
`tab`_( optional enumerated [Tab](tabs.html#type-Tab) array of paramType )_
Undocumented.
被更新的標簽細節。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
### Events
#### onAttached
chrome.tabs.onAttached.addListener(function(integer tabId, object attachInfo) {...});
Undocumented.
當標簽附著在窗口上,此事件被觸發。例如,此事件會發生在標簽在窗口之前移動時。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`attachInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`newWindowId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`newPosition`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onCreated
chrome.tabs.onCreated.addListener(function(Tab tab) {...});
Undocumented.
標簽創建時,此事件觸發。請注意,當事件觸發時,標簽的 URL 可能沒有被設置, 但是當URL被設置時,可以通過onUpdated 事件接聽。
#### Parameters
`tab`_( optional enumerated [Tab](tabs.html#type-Tab) array of paramType )_
Undocumented.
標簽創建的細節。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onDetached
chrome.tabs.onDetached.addListener(function(integer tabId, object detachInfo) {...});
Undocumented.
當標簽從窗口脫離時,此事件被觸發,例如標簽在窗口之間移動。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`detachInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`oldWindowId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`oldPosition`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onMoved
chrome.tabs.onMoved.addListener(function(integer tabId, object moveInfo) {...});
Undocumented.
當標簽在窗口內移動時,此事件被觸發。只有一個移動事件被觸發,給用戶直接移動的標簽。其他響應移動事件的標簽不觸發移動事件。 請參閱 [onDetached](tabs.html#event-onDetached).查看詳情。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`moveInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`windowId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`fromIndex`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`toIndex`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onRemoved
chrome.tabs.onRemoved.addListener(function(integer tabId, object removeInfo) {...});
Undocumented.
標簽關閉時被觸發。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`removeInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`isWindowClosing`_( optional enumerated Type array of boolean )_
Undocumented.
當窗口被關閉,標簽隨之被關閉時,此參數為true。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onSelectionChanged
chrome.tabs.onSelectionChanged.addListener(function(integer tabId, object selectInfo) {...});
Undocumented.
當窗口選中的標簽改變時,此事件觸發
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
被選中標簽的ID。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`selectInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`windowId`_( optional enumerated Type array of integer )_
Undocumented.
標簽發生變化的窗口ID。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onUpdated
chrome.tabs.onUpdated.addListener(function(integer tabId, object changeInfo, Tab tab) {...});
Undocumented.
當標簽更新時,此事件被觸發。
#### Parameters
`tabId`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`changeInfo`_( optional enumerated Type array of object )_
Undocumented.
列出標簽更新時的狀態。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`status`_( optional enumerated Type array of string )_
Undocumented.
標簽的狀態。可以為 _loading_ or _complete_。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`url`_( optional enumerated Type array of string )_
Undocumented.
經歷變化的標簽的URL。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`pinned`_( optional enumerated Type array of boolean )_
Undocumented.
標簽被鎖定的新狀態。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`tab`_( optional enumerated [Tab](tabs.html#type-Tab) array of paramType )_
Undocumented.
更新的標簽的狀態。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
### Types
#### Tab
`paramName`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`id`_( optional enumerated Type array of integer )_
Undocumented.
標簽ID。在一個瀏覽器會話內, 標簽ID是唯一的。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`index`_( optional enumerated Type array of integer )_
Undocumented.
窗口內從零開始的標簽索引。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`windowId`_( optional enumerated Type array of integer )_
Undocumented.
標簽所在窗口的窗口ID。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`selected`_( optional enumerated Type array of boolean )_
Undocumented.
標簽是否被選中。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`pinned`_( optional enumerated Type array of boolean )_
Undocumented.
標簽是否被鎖定。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`url`_( optional enumerated Type array of string )_
Undocumented.
標簽所顯示的URL。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`title`_( optional enumerated Type array of string )_
Undocumented.
標簽的標題。當標簽被加載時,標題可能不能被成功獲取。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`favIconUrl`_( optional enumerated Type array of string )_
Undocumented.
標簽收藏夾圖標的URL。當標簽被加載時,圖標可能不能被成功獲取。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`status`_( optional enumerated Type array of string )_
Undocumented.
可以被設置為 _loading_ 或者 _complete_。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`incognito`_( optional enumerated Type array of boolean )_
Undocumented.
可以被設置為 _loading_ 或者 _complete_.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
- 基礎文檔
- 綜述
- 調試
- 格式:Manifest文件
- 模式匹配
- 改變瀏覽器外觀
- Browser Actions
- Context Menus
- 桌面通知
- Omnibox
- Override替代頁
- Page Actions
- 主題
- 與瀏覽器交互
- 書簽
- Cookies
- chrome.devtools.* APIs
- Events
- chrome.history
- Management
- 標簽
- 視窗
- 實現擴展
- 無障礙性(a11y)
- 背景頁
- Content Scripts
- 跨域 XMLHttpRequest 請求
- 國際化 (i18n)
- 消息傳遞
- Optional Permissions
- NPAPI 插件
- 完成并發布應用
- 自動升級
- 托管
- 打包
- 規范和協議
- 應用設計規范
- 開發人員協議
- 免責聲明