我正在尝试使用KangoExtensions构建浏览器扩展。动态iframe在Firefox上不可见
我追加了以下iFrame机体:
<iframe id="iframe" name="iframe" allowtransparency="yes"
style="position: absolute; top: -41px; left: 0px; right: 0px; width: 100%; height: 41px; z-index: 10000; border: 0px none;">
</iframe>
后我追加的iframe我尝试写的内容:
window.onload= function(){
$(iframe).ready(function(){
var iframeDocument = false;
if(iframe.contentDocument) {
iframeDocument = iframe.contentDocument;
} else if(iframe.contentWindow) {
iframeDocument = iframe.contentWindow.document;
} else if(window.frames['iframe'].document) {
iframeDocument = window.frames['iframe'].document;
}
if(iframeDocument) {
iframeDocument.open();
iframeDocument.write(content);
}
});
};
扩展在所有浏览器(Chrome浏览器, Opera,IE),但在Firefox中,它不会向iframe写入任何内容。如果我使用iframeDocument.body.innerHTML = content;
,则内容在几毫秒内可见,然后消失。我只看到一个灰色(ish)的矩形。
对于Firefox扩展中的iframe可以做些什么限制?
尝试添加'SRC = “有关:空白”'的''
试过了。不起作用 – 2012-08-14 08:59:45