我正在嘗試使用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