gpt4 book ai didi

html - 如何在 iframe 中显示 google.com?

转载 作者:技术小花猫 更新时间:2023-10-29 11:27:48 25 4
gpt4 key购买 nike

我正在尝试将 google.com 放入我网站的 iframe 中,这适用于包括雅虎在内的许多其他网站。但它不适用于谷歌,因为它只显示一个空白的 iframe。为什么不渲染?有什么技巧可以做到这一点吗?

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

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

google.com 页面不会在 iframe 中呈现,它只是空白。这是怎么回事?

最佳答案

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

参见:Mozilla Developer Network - The X-Frame-Options response header

关于html - 如何在 iframe 中显示 google.com?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8700636/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com