【问题标题】:Loading http page in an iframe of https page在 https 页面的 iframe 中加载 http 页面
【发布时间】:2017-12-26 07:31:24
【问题描述】:

我在 https 站点中有一个页面,例如 https://www.example.com,其中包含一个 iframe,该 iframe 指向同一站点中的另一个 php 页面 target.php

<iframe src="/target.php"></iframe> 

此 target.php 正在使用

将请求重定向到另一个 http url
header("Location: http://demosite/page"  ,TRUE, 307) 

不幸的是,这种对 http 站点的重定向在 https iframe 中不起作用。虽然它适用于 http 页面中的 iframe 。

我试过了

file_get_contents("http://demosite/page") 

并在target.php 中卷曲(而不是标头重定向)。那些没有以正确的格式返回页面。

请有人告诉我如何在 https 页面的 iframe 中显示 http 页面。

提前致谢。

【问题讨论】:

    标签: php iframe https


    【解决方案1】:

    在重定向中省略协议。然后它会自动使用与访问target.php相同的协议:

    header("Location: //demosite/page", true, 307);
    

    【讨论】:

    • 对不起,这不起作用。此 php 页面位于 https 站点中。演示站点是一个 http 页面。它不能提供安全连接。所以“demosite/page”的 https 链接总是失败
    猜你喜欢
    • 2015-08-07
    • 2021-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-21
    • 1970-01-01
    相关资源
    最近更新 更多