简体   繁体   中英

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 .

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

This target.php is redirecting the request to another http url using

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

Unfortunately , this redirection to http site is not working from the https iframe . Although it works from iframe in http page .

I have tried

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

and curl in target.php (instead of header redirection) . 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.

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 :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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