【问题标题】:Reloading iframes on load in Adobe edge在 Adob​​e Edge 中加载时重新加载 iframe
【发布时间】:2013-10-02 07:55:35
【问题描述】:

我正在使用 Adob​​e Edge 构建一个网站,并且我有一些 iframe 可以在我的 index.html 页面上加载其他 html 页面。所有文件都在同一个域中。

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

我在此页面上看到了一个可能的解决方案: How to force an iFrame to reload once it loads

我只是不确定将解决方案脚本放在 adobe edge 的哪个位置。

这是“creationComplete”中每个 iframe 现在的样子:

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

【问题讨论】:

    标签: javascript jquery iframe adobe-edge


    【解决方案1】:
    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 中的 iFrame 没有问题。如果这对您不起作用,请告诉我。

    【讨论】:

      猜你喜欢
      • 2014-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-18
      • 2012-03-05
      • 2023-03-31
      • 2012-06-17
      • 2015-02-26
      相关资源
      最近更新 更多