从我的网站加载网站

从我的网站加载网站

问题描述:

我在想,如果可以将网站从我的网站加载网站

中加载的网站,所以我有我的index.html文件。当你在中心的文件,它会有一个像框架或东西,将加载http://google.com,你可以在我的网站内导航谷歌

+2

是的,你可以使用iframe,如果该网站允许它框架。谷歌没有。 – epascarello

你是正确的使用iFrame加载其他网站,如YouTube。

<div style='width:1000px;margin:auto;'> 
    <iframe id="theFrame" src="http://www.youtube.com" style="width:100%;" frameborder="0"></iframe> 
</div> 
+0

你尝试过吗? – epascarello

+0

@epascarello当我粘贴此代码时,它只是白色。 https://evemirror.com/mirror/modules/lyft/ –

+0

您可以使用iFrame加载其他网站,但我不知道Google不允许您加载他们的网站。我认为唯一的限制是不编辑JS,如果它的另一个域。 –

是的,你可以加载网站在iframes,如果他们允许它。

但是并非所有的网站都允许它,因为它们设置了标头X-Frame-Options,浏览器检测到该标头并且不允许网站加载。如果您尝试将Google粘贴到iframe中,您将在控制台中看到此错误消息。

Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'. 
+0

有没有其他方法可以做到这一点?也许没有iFrame? –

+3

编写您自己的浏览器并忽略限制? – epascarello