这适用于一些网站,例如 www.-6ren">
gpt4 book ai didi

html - 如何将外部网站嵌入我的网站?

转载 作者:行者123 更新时间:2023-12-01 21:50:26 25 4
gpt4 key购买 nike

我正在尝试将外部网站嵌入到我的网站中,这样我就可以引用一个网站并让它显示该网站。我尝试使用此代码执行此操作:

<iframe src="<WEBSITE URL>" width="100%" height="300"></iframe>

这适用于一些网站,例如 www.wikipedia.org但是当我尝试其他网站时 www.twitter.com我刚收到一条错误消息:“twitter.com 拒绝连接。”我该怎么做才能将这些其他网站嵌入到我的网站中?

最佳答案

网站所有者可以选择不允许将其嵌入其他网站。他们可以使用 X-Frame-Options 来做到这一点 header 。你无法绕过这一点。

运行 curl 命令 curl -I https://twitter.com 你可以看到标题列表,x-frame-options: DENY 就是其中之一.

... snipped
x-content-type-options: nosniff
x-frame-options: DENY
x-response-time: 19
x-transaction: 00fafa890079c168
x-twitter-response-tags: BouncerCompliant
x-ua-compatible: IE=edge,chrome=1
x-xss-protection: 0

关于html - 如何将外部网站嵌入我的网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59548917/

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