sidebarAction

獲取和設定擴充套件側邊欄的屬性。

一個 側邊欄 是顯示在網頁左側或右側的窗格。瀏覽器提供了一個使用者介面,使使用者可以看到可用的側邊欄並選擇一個來顯示。擴充套件使用 sidebar_action manifest.json 鍵來定義側邊欄。然後,擴充套件可以使用此 API 來獲取和設定側邊欄的屬性。

注意:Chrome 透過 sidePanel API 支援側邊欄。此 API 與 sidebarAction 不相容。

sidebarAction API 基於 Opera 的 sidebarAction API,並且在很大程度上模仿了 browserAction API。但是,Firefox 沒有實現 setBadgeText()getBadgeText()setBadgeBackgroundColor()getBadgeBackgroundColor()onFocusonBlur

型別

sidebarAction.ImageDataType

影像的畫素資料。必須是一個 ImageData 物件(例如,來自 <canvas> 元素)。

函式

sidebarAction.close()

關閉側邊欄。

sidebarAction.getPanel()

獲取側邊欄的面板。

sidebarAction.getTitle()

獲取側邊欄的標題。

sidebarAction.isOpen()

檢查側邊欄是否開啟。

sidebarAction.open()

開啟側邊欄。

sidebarAction.setIcon()

設定側邊欄的圖示。

sidebarAction.setPanel()

設定側邊欄的面板。

sidebarAction.setTitle()

設定側邊欄的標題。此標題顯示在瀏覽器用於列出側邊欄的任何 UI 中,例如選單。

sidebarAction.toggle()

切換側邊欄的可見性。

示例

瀏覽器相容性