Creating a Firefox sidebar 编辑
Since Firefox 57, the only way to create a Firefox sidebar is to create a WebExtension with the sidebar_action
manifest.json key.
Web publishers can offer visitors a Firefox sidebar to encourage their engagement. There are two ways to create a sidebar for Firefox users: the Social API and an extension. You can choose either depending on your needs and resources.
An extension
An extension is a kind of add-ons that adds new functionalities to Firefox. There is a wide range of extensions available, and some of them provide a sidebar. Such kind of sidebar can be a simple Web panel or a full-featured extension that is completely integrated with the browser. There are some ways to create an extension:
- The WebExtension
sidebar_action
API available since Firefox 54. - The new sidebar API has been implemented in Firefox 29 as part of the Add-on SDK. It's the easiest way to create an extension with a sidebar.Obsolete since Gecko 57
- You can also build a restartless extension yourself without the SDK. A sample extension to add a Web panel is available as a starter.Obsolete since Gecko 57
- If you'd like to have a deeper integration with the browser to offer more complex features, a traditional overlay extension can be an option. The document might be obsolete, though.Obsolete since Gecko 57
The Social API
Obsolete since Gecko 57 (Firefox 57 / Thunderbird 57 / SeaMonkey 2.54)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
This content covers features introduced in Firefox 17.
The Social API is a new API from Mozilla that allows social media services to integrate their content into the browser window. At this time, Facebook, Cliqz, mixi and MSN are partnering with Mozilla as social providers. Now the API is available to all Web developers so it's worth checking out if you are offering a social service.
The window.sidebar API
Obsolete since Gecko 23 (Firefox 23 / Thunderbird 23 / SeaMonkey 2.20)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
As of Firefox 23, the addPanel
and addPersistentPanel
functions have been removed from the deprecated, Netscape-derived window.sidebar
object. That means the ability to add a traditional sidebar panel is no longer available from Web content. The new Social API or an extension can be used instead as described above.
See Also
- Bootstrap addon demo which adds a sidebar with browser for HTML content: https://gist.github.com/Noitidart/8728393
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论