Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
391 views
in Technique[技术] by (71.8m points)

html - Can't show some websites in iframe tag

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>

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 = 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...