在https页面的iframe中加载http页面

问题描述 投票:1回答:1

我在https网站上有一个页面说https://www.example.com,其中包含一个指向同一网站中另一个php页面target.php的iframe。

<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个回答
0
投票

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

header("Location: //demosite/page", true, 307);
© www.soinside.com 2019 - 2024. All rights reserved.