通过 iFrame 将新的 Google 网站嵌入到其他网页

Tom*_*hen 1 html javascript iframe embedded-resource

我希望你今天过得愉快!我正在尝试将新的 Google 网站嵌入到另一个网页中。我正在尝试使用 iframe 嵌入 Google 网站,但它不起作用。

代码行:

<iframe width="1280" height="720" src="https://sites.google.com/view/dm-viewer-samples" frameborder="0" scrolling="yes"></iframe>
Run Code Online (Sandbox Code Playgroud)

控制台错误:

拒绝在框架中显示“ https://accounts.google.com/ServiceLogin?passive=1209600&continue=https://sites.google.com/s/1qcUAedTDdwcpfVAuSclwMF0K0bM2o2Lq/edit?userId%3D0 ”,因为它设置了“X-Frame” -选项'到'拒绝'。

小智 5

正如这篇文章回答中所说,由于 HTTP 标头,您不能将此站点包含到 iframe 中:

X-Frame-Options: SAMEORIGIN
Run Code Online (Sandbox Code Playgroud)