duanpai1033 2018-03-15 09:58
浏览 134
已采纳

访问控制允许标题不允许加载iframe的内容

I have two php pages in the same directory. These are edit_page.php and page.php.

edit_page.php has a wysiwyg editor where I can edit the contents of another page through an iframe. the source for the iframe is page.php with a query ?page_id=XXX.

When I go to page.php?page_id=XXX I can see the following headers:

enter image description here

However when I go to edit_page.php?page_id=XXX I see the following errors in the console:

enter image description here

I tried putting the headers in the page sending the request just for the laugh even though I know that it is making the request and not sending the response header.... worth a try :P

enter image description here

The headers I'm sending are:

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST");
header("Access-Control-Allow-Headers: Content-Type");
header("X-Frame-Options: *"); 

I'm a bit stuck with this one I've never come across this kind of issue before. If anyone can point me in the right direction that would be greatly appreciated.

Also if anyone can explain why this is happening in the first place that would be great. My understanding was that this would happen with pages from a cross origin e.g. loading content from an external source not on the same domain. But obviously these two files are not only on the same domain but in the same directory.

  • 写回答

2条回答 默认 最新

  • douxuan1284 2018-03-15 10:26
    关注

    Ok now I feel stupid....

    I had:

    <iframe name="richTextField" id="wysiwyg" src="page?page_id=1"></iframe>
    

    Instead of:

    <iframe name="richTextField" id="wysiwyg" src="page.php?page_id=1"></iframe>
    

    Going brain dead I think

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器