1

Possible Duplicate:
How to show google.com in an iframe?

I am researching possible methods of running a proxy server for a school project.

I thought about using iframes to load a web page inside another web page, so I made a test.

Here is my HTML:

<html>
  <body>
    <IFRAME SRC="http://google.com" WIDTH=1024 HEIGHT=768>
      Not loaded
    </IFRAME>
  </body>
</html>

However, http://google.com doesn't load, and instead the iframe remains white.

On further inspection, Google Chrome's GET request to load google.com has been cancelled.

I suspect that google stop people from loading their site in iframes, but why is this, and what are the effects of it?


Edit: I forgot to mention, other websites (like my own) work fine.

Community
  • 1
  • 1
Todd Davies
  • 5,484
  • 8
  • 47
  • 71
  • The effects are pretty obvious: a few lines extra in their JS and nobody can load google.com in an iframe. – 11684 Sep 04 '12 at 14:11
  • Duplicate of [How to show google.com in an iframe?](http://stackoverflow.com/questions/8700636/how-to-show-google-com-in-an-iframe) > The reason for this is, that Google is sending an "X-Frame-Options: > SAMEORIGIN" response header. This option prevents the browser from > displaying iFrames that are not hosted on the same domain as the > parent page. See: [Mozilla Developer Network - The X-Frame-Options > response header](https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header) – Arthur Halma Sep 04 '12 at 14:12
  • @ArthurHalma http://meta.stackexchange.com/questions/78658/is-it-okay-to-copy-paste-answers-from-other-questions – 11684 Sep 04 '12 at 14:25

1 Answers1

8

Because it has X-Frame-Options Header policy and browsers tend to respect those policies.

Read here and here

The "X-Frame-Options" allows a secure web page from host B to declare that its content (for example a button, links, text, etc.) must not be displayed in a frame of another page (e.g. from host A). In principle this is done by a policy declared in the HTTP header and obeyed by conform browser implementations.

Community
  • 1
  • 1
Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107