【问题标题】:Secure page in frame doesn't see parent page框架中的安全页面看不到父页面
【发布时间】:2013-09-12 12:25:02
【问题描述】:

我有这个页面http://domain.com

<html>
<div id="anyDiv" style="display:none">Hello</div>
<iframe src="https://domain.com/iframe"></iframe>
</html>

在 iframe https 页面我有代码

window.top.$('#anyDiv').show();

如果我的父页面也是 https,它会很好用。但如果它是 http - 它不起作用。 我能做什么?

【问题讨论】:

    标签: javascript jquery html iframe https


    【解决方案1】:

    尝试在 div 中加载()你的 https://domain.com/iframe 怎么样?

    HTML:

    <div id="anyDiv" style="display:none">Hello</div>
    <div id="iframeDiv"></div>
    

    JS:

    var iframePage = "https://domain.com/iframe"
    
    $('#iframeDiv').load(iframePage , function (responseText, statusText, xhr) {
        if (statusText == "error") {
                    alert( "Not able to load file!!");
            }
    });
    

    不确定你会得到什么结果,但这可能是一种尝试。

    【讨论】:

    • 我使用了 posmmessage.js - 这个东西甚至在 ssl 安全页面上也能正常工作!
    猜你喜欢
    • 2017-05-26
    • 1970-01-01
    • 2012-09-18
    • 1970-01-01
    • 1970-01-01
    • 2012-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多