【问题标题】:Firefox add-on to display iFrame用于显示 iFrame 的 Firefox 插件
【发布时间】:2011-05-08 09:09:09
【问题描述】:
【问题讨论】:
标签:
firefox
iframe
firefox-addon
【解决方案1】:
这里是叠加的方法。
文章:Creating toolbar button@MDC
弹窗的XUL可以参考notification-popup和identity-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 的页面的域的文件)