0

I want to embed the google home page in a page on my website. I want to use the <object> html5 element because from what I've read this is the most up-to-date way to do this and should work on ie7+ and everything else.

But I'm having problems getting it to work. Here's what I'm using:

<object type="text/html" data="http://www.google.co.uk" style="width: 1000px; height: 600px;"></object>

If I change the url to something different it works fine, but with google... nothing.

Am I missing something? I can't figure out what I'm doing wrong?


this is the most up-to-date way

It isn't. <object> is simply a generic way. It is inconsistently supported.

If you want to embed HTML documents, use an iframe.

That won't help in this situation though. In the HTTP headers for the page, Google say:

X-Frame-Options: SAMEORIGIN

They are forbidding you from embedding their page inside yours, and your browser is respecting their wishes.

4

1 回答 1

1

这是最新的方式

它不是。<object>只是一种通用的方式。它受到不一致的支持。

如果要嵌入 HTML 文档,请使用 iframe。

不过,这在这种情况下无济于事。在页面的 HTTP 标头中,Google 说:

X-Frame-Options: SAMEORIGIN

他们禁止您将他们的页面嵌入到您的页面中,并且您的浏览器尊重他们的意愿。

于 2013-02-19T15:01:07.570 回答