sidebarAction

获取和设置扩展的侧边栏的属性。

侧边栏是显示在浏览器窗口左侧或右侧紧挨着网页部分的面板。浏览器提供了相应的用户界面,让用户可以查看当前可用的侧边栏,并选择要显示的侧边栏。使用 sidebar_action manifest.json 键,扩展可以定义自己的侧边栏。使用这里描述的 sidebarAction API,扩展可以获取和设置侧边栏的属性。

sidebarAction API 与 browserAction API 非常相似。

sidebarAction API 是基于 Opera 的 sidebarAction API。但是请注意,以下特性尚不支持: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()

切换侧边栏的可见性。

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
sidebarAction
ImageDataType
close
getBadgeBackgroundColor
getBadgeText
getPanel
getTitle
isOpen
onBlur
onFocus
open
setBadgeBackgroundColor
setBadgeText
setIcon
The path and imageData properties of the details parameter can be set to null.
setPanel
The panel property of the details parameter can be set to null.
setTitle
The title property of the details parameter can be set to null.
toggle

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

示例附加组件

备注: 此 API 基于 Opera 的 chrome.sidebarAction API。