隐藏

X-Frame-Options SAMEORIGIN阻止我网域上的iframe(X-Frame-Options SAMEORIGIN blocking iframe on my domain)

发布:2020/9/12 9:48:06作者:管理员 来源:本站 浏览次数:1453

i'm using http://www.jacklmoore.com/colorbox to display the content of an url in a lightbox. after implementation, the colorbox did'nt showed anything.

Later, i noticed the following error in chrome logs:

Refused to display document because display forbidden by X-Frame-Options.

so after documenting i added the following line to the root .htaccess of the website :

Header always append X-Frame-Options SAMEORIGIN

to allow iframe embedding on my own domain.

But i still get the error, i'm newbie to x-frame, and i'm working on an existing application, so i thought the .htaccess solution would be nice, but can it be overrided by some code ? Notice that it's not in the server configuration.

解决方案

Try sending another X-Frame-Options header, add

<?php header('X-Frame-Options: GOFORIT'); ?>

to the top of your page. It should disable the SAMEORIGIN command.

我正在使用 http://www.jacklmoore.com/colorbox 在灯箱中显示网址的内容。
实现后,colorbox没有显示任何内容。



后来,我注意到chrome日志中出现以下错误:



 拒绝显示文档,因为X-Frame-Options禁止显示。 
  


所以在记录后我将以下行添加到网站的根.htaccess:



 标题总是附加X-Frame-Options SAMEORIGIN 
  


允许iframe嵌入我自己的域。



但我仍然得到错误,我是x-frame的新手,而我我正在研究一个现有的应用程序,所以我认为.htaccess解决方案会很好,但它可以被某些代码覆盖吗?请注意,它不在服务器配置中。


解决方案

尝试发送另一个X-Frame-Options标头,添加



 <?php header('X-Frame-Options:GOFORIT'); ?> 
  


到页面顶部。
它应该禁用SAMEORIGIN命令。