简体   繁体   English

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

[英]Loading http page in an iframe of https page

I have a page in a https site say https://www.example.com which contains an iframe that points to another php page target.php in same site . 我在https网站上有一个页面,说https://www.example.com ,其中包含一个指向同一站点中另一个PHP页面target.php的iframe。

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

This target.php is redirecting the request to another http url using 此target.php使用重定向请求到另一个http url

header("Location: http://demosite/page"  ,TRUE, 307) 

Unfortunately , this redirection to http site is not working from the https iframe . 不幸的是,从https iframe无法重定向到http站点。 Although it works from iframe in http page . 虽然它可以从http页面的iframe使用。

I have tried 我努力了

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

and curl in target.php (instead of header redirection) . 并卷曲在target.php (而不是标头重定向)。 Those did not return the page in proper format . 那些没有以正确的格式返回页面。

Please can someone advise me how to display a http page in an iframe of https page. 请有人告诉我如何在https页面的iframe中显示http页面。

Thanks in advance . 提前致谢 。

Leave out the protocol in the redirection. 在重定向中忽略协议。 Then it will automatically use the same protocol that was used to access target.php : 然后它将自动使用用于访问target.php的相同协议:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM