如何在iframe中显示google.com? [英] How to show google.com in an iframe?

查看:147
本文介绍了如何在iframe中显示google.com?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将google.com放到我的网站上的iframe中,这与许多其他网站(包括雅虎)协同工作。但它不适用于谷歌,因为它只显示一个空白的iframe。为什么它不呈现?是否有任何技巧可以做到这一点?

I am trying to put google.com into an iframe on my website, this works with many other websites including yahoo. But it does not work with google as it just shows a blank iframe. Why does it not render? Are there any tricks to do that?

我已经以通常的方式尝试在iframe中显示网站:

I have tried it in an usual way to show a website in an iframe like this:

<iframe name="I1" id="if1" width="100%" 
 height="254" style="visibility:visible" 
 src="http://www.google.com"></iframe>

google.com网页不会在iframe中呈现,它只是空白。发生了什么事?

The google.com page does not render in the iframe, it's just blank. What is going on?

推荐答案

原因是Google正在发送一个X-Frame-Options:SAMEORIGIN响应标题。此选项可防止浏览器显示与父页面不在同一域中的iFrame。

The reason for this is, that Google is sending an "X-Frame-Options: SAMEORIGIN" response header. This option prevents the browser from displaying iFrames that are not hosted on the same domain as the parent page.

请参阅: Mozilla开发者网络 - X-Frame-Options响应标题

这篇关于如何在iframe中显示google.com?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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