【问题标题】:Mac Google Chrome iframe Access Parent WindowMac Google Chrome iframe 访问父窗口
【发布时间】:2010-11-24 04:21:52
【问题描述】:

我正在尝试访问 iframe 的父窗口并设置 iframe 的高度。

以下代码适用于 Windows IE7/IE8/Chrome/FireFox 3.6 和 Mac FireFox/Safari。

但在 Mac Chrome 上,它似乎没有访问父窗口。

在父页面上我有一个 iframe:

<iframe src="iframe_saleinfo.html" id="saleInformationIframe" frameborder="0"></iframe>

在 iframe.html 中:

$(document).ready(function() {
    var theFrame = $('#saleInformationIframe', window.top.document);
    theFrame.height($(document.body).height() + 30);
});

我也试过了:

$(document).ready(function() { 
    var theFrame = $('#saleInformationIframe', top.document);
    theFrame.height($(document.body).height() + 30);
});

我已经试过了:

$(document).ready(function() { 
    var theFrame = $('#saleInformationIframe', parent.document.body);
    theFrame.height($(document.body).height() + 30);
});

我试过了:

$(document).ready(function() { 
    var theFrame = $('#saleInformationIframe', window.parent.document);
    theFrame.height($(document.body).height() + 30);
});

提前致谢,

杰德。

【问题讨论】:

    标签: macos iframe google-chrome window parent


    【解决方案1】:

    这似乎是 Chrome Mac 的本地问题。我没有在测试 mac 上安装 Web 服务器,但是当我将文件上传到服务器并从那里查看时,一切似乎都正常。

    谢谢,

    杰德。

    【讨论】:

      猜你喜欢
      • 2012-07-24
      • 1970-01-01
      • 1970-01-01
      • 2013-04-24
      • 1970-01-01
      • 2012-04-05
      • 2018-12-18
      • 1970-01-01
      • 2011-10-25
      相关资源
      最近更新 更多