最近测试google 嵌入iframe的一个东西, 突然发现不能显示了。 IE如下图表现:

有些站点不能被iframe

有点稀奇,之前从来没了解过。

通过javascript 判断 parent.location 和 locaiton 倒是可以做到, 但显然这个不是google输出的,而是IE浏览器的显示。

 

使用 X-Frame-Options header 拒绝被嵌入框架(iframe…)

在header中增加 X-Frame-OptionsSAMEORIGIN  输出,如下图:

有些站点不能被iframe

兼容性:

 

Browser Lowest version
Internet Explorer 8.0
Firefox (Gecko) 3.6.9 (1.9.2.9)
Opera 10.50
Safari 4.0
Chrome 4.1.249.1042

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
猜你喜欢
  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-01-30
  • 2021-05-30
相关资源
相似解决方案