2013-10-02 57 views
1

我使用Adobe Edge构建网站,并且我的一些iframe在我的index.html页面上加载了其他html页面。所有文件都在同一个域中。在Adobe Edge中加载重新加载内联框架

不知道为什么,但一些iframes内容无法在firefox中正确加载。但是当我刷新iframe时,它会加载完美,所以我需要iframe在加载时自动重新加载(仅一次)。

Iv'e看到此页面上的可能的解决方案: How to force an iFrame to reload once it loads

我只是不知道在哪里在Adobe边把解决脚本。

这是“creationComplete”每一个IFRAME的外观现在:

sym.$("AboutPage").append('<iframe width="100%" height="100%" src="About.html" frameborder="0" scrolling="no"></iframe>'); 

回答

0
sym.$("AboutPage").append('<iframe onload="reloadOnce(this)" width="100%" height="100%" src="About.html" frameborder="0" scrolling="no"></iframe>'); 
sym.$("otherPage").append('<iframe onload="reloadOnce(this)" width="100%" height="100%" frameborder="0" scrolling="no" src="otherPage.html"></iframe>'); 

var iframeLoadCount = 0; 
function reloadOnce(iframe) { 
    iframeLoadCount ++; 
    if (iframeLoadCount <= 1) { 
    iframe.contentWindow.location.reload(); 
    console.log("reload()"); 
    } 
} 

我认为这是代码是如何想被写入“creationComplete”我不是100%肯定,因为我在我的电脑上加载FireFox中的iFrames时没有问题。让我知道如果这不适合你。