0

I have one iframe in my page that will load the local html content but not loading remote web content.

Here is the code :

<iframe id="frame1" src="http://localhost/test.html" width="520px" height="400px" scrolling="auto"></iframe>

This is working.

But the following code is not working :

<iframe id="frame1" src="http://www.google.co.in/" width="520px" height="400px" scrolling="auto"></iframe>

Please any help

Girish Hosamani
  • 1,203
  • 12
  • 18

2 Answers2

1

Google uses an X-FRAME-OPTIONS HTTP header to disallow putting their pages in iframes: https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header

Almost all modern browsers will refuse to put pages with this HTTP header in an iframe. There's nothing you can do about that.

Hoijof
  • 1,343
  • 15
  • 27
0

If you take a look into the console you see this:

[Error] Refused to display 'https://www.google.co.in/?gws_rd=ssl' in a frame
because it set 'X-Frame-Options' to 'SAMEORIGIN'.

What means that Google doesn't want to be displayed in an iframe.

More about X-Frame-Options

idmean
  • 14,540
  • 9
  • 54
  • 83