无法在 iframe 标签中显示某些网站 [英] Can't show some websites in iframe tag

查看:42
本文介绍了无法在 iframe 标签中显示某些网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个可以同时显示 3 个以上网站的页面,如下:

I am trying to develop a page in which I can show more than 3 website at a time, as below:

<ul>
   <li>
      <iframe src="http://www.facebook.com/" /><p> iframe is not supported</p>
   </li>
   <li>
      <iframe src="http://www.yahoo.com/"></iframe>
   </li>
   <li>
      <iframe src="http://www.google.co.in"></iframe>
   </li>
</ul>

问题是它显示了 yahoo.com 和 google.co.in,但没有在 iframe 中显示 Facebook.

The problem is that it shows yahoo.com and google.co.in, but does not display Facebook in the iframe.

推荐答案

您必须检查这些站点的 HTTP 响应头 X-Frame-Option.如果其值为DENY 或 SAMEORIGIN",则无法在 iframe 中加载这些网站.

You have to check for HTTP response header X-Frame-Option of those sites. if its value is "DENY or SAMEORIGIN", then you can not load those website in the iframes.

DENY = 没有人可以在 iframe 中加载网站.即使是同一个域页面也无法加载.SAMEORIGIN = 只有在同一域中的页面才能在 iframe 中加载此网站.

DENY = No one can load the website in iframe. Even the same domain page wont be able to load. SAMEORIGIN = only a page which is in same domain can load this website in iframe.

这篇关于无法在 iframe 标签中显示某些网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆