【问题标题】:Firefox add-on to display iFrame用于显示 iFrame 的 Firefox 插件
【发布时间】:2011-05-08 09:09:09
【问题描述】:

我正在尝试创建 Firefox 插件,它将在地址栏附近添加一个图标,当用户单击它时,它将显示一个我将设置的 iframe。 类似于 chrome 扩展的东西,像这样:

http://code.google.com/chrome/extensions/images/hello-world.png

谢谢

【问题讨论】:

  • 您需要更具体地说明您需要帮助的内容。

标签: firefox iframe firefox-addon


【解决方案1】:

这里是叠加的方法。

文章:Creating toolbar button@MDC

弹窗的XUL可以参考notification-popupidentity-popup(建议)在chrome://browser/content/browser.xul

并且 iframe 在 XUL 中可用。

<panel id="sth-popup" type="arrow" hidden="true" noautofocus="true" onpopupshown="(initial action)" level="top">
    <iframe id="sth-body" src="chrome://(extenstion name)/(sth html)" flex="1"/>
</panel>

工具栏按钮的监听器(onclick、onkeypress)请参考gIdentityHandler . handleIdentityButtonEventat chrome://browser/content/browser.js


如果您的插件是自举扩展,请参考 Oxymoronical 的 Playing with windows in restartless (bootstrapped) extensions

需要Javascript DOM控制技术。

参考XUL的例子,简单地通过document.createElement方法甚至document.createElementNS(XULNS, "(tag name)")方法创建元素,其中const XULNS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';已经写了。


随时询问更多信息并成为我们的注册用户之一。 :-)

【讨论】:

    【解决方案2】:

    您的问题在于 iframe 的创建?还是创建 iframe 内容? (例如,您不能将 src 属性设置为不是您要显示 iframe 的页面的域的文件)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多