firefox - 如何在带有扩展的 Firefox 中的工具栏按钮上创建弹出窗口

标签 firefox firefox-addon xul toolbar popover

我正在开发 firefox 扩展,它需要用 html 文档显示弹出窗口。在 Safari 和 Chrome 中,有一种非常简单的方法来创建弹出窗口,但目前我花了 2 天的时间寻找在 Firefox 中执行相同操作的方法,但我在文档中找不到用于执行此操作的页面。

有人可以向我提供代码示例、教程或文档的链接吗,我将非常感激。

这是 Safari 中弹出窗口的图像 enter image description here

最佳答案

在基于 xul 的插件中,这可以通过面板来完成。如果您看到the page for the type property面板,它们有与您想要的类似的东西。

enter image description here

你会做的是:

<toolbarpalette id="BrowserToolbarPalette">
      <toolbarbutton id="yourToolbarbutton"
                       image="chrome://yourExt/content/image.png"
                       class="toolbarbutton-1 chromeclass-toolbar-additional">
            <panel id="yourPanel"
                       type="arrow"
                       noautofocus="true"
                       consumeoutsideclicks="true"
                       onpopupshowing="functionToFillThePanel();"
                       level="top">

                   content goes here
             </panel>
     </toolbarbutton>
/toolbarpalette>

关于firefox - 如何在带有扩展的 Firefox 中的工具栏按钮上创建弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20306858/

相关文章:

CSS 未在 FF 中加载。不同于其他问题

asp.net - 强制客户端忽略 PDF.js 的服务器端解决方法(Firefox 的内置查看器以 .aspx 扩展名保存)

jQuery 无法在 Firefox 插件上完全运行

firefox - Firefox 右键菜单的 class/id 是什么?

html - 元素之间的意外间隙

javascript - 使用 Firefox,我如何监控所有触发的事件?

javascript - 以编程方式从 javascript 调用 firefox 扩展

javascript - 如何模拟鼠标点击 Firefox 扩展中的任何 HTML 元素(iframe、对象等)?

javascript - 获取 Firefox 扩展中选定文本的 HTML

javascript - php 在 Firefox 和 Chrome 中流式传输 wav