0

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

I am a newbie to html. I am learning the html tag 'iframe'. I understand it's the way to embed page in another page. But I try to play it in w3school editor change the url to www.google.com, it doesn't work:

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe

Can anyone tell me why. Thanks in advance.

Community
  • 1
  • 1
David Thompson
  • 149
  • 2
  • 7

2 Answers2

1

Google does not allow its pages to be served to a frame. To be more specific, its server sends this header:

X-Frame-Options: SAMEORIGIN

Supporting and compliant browsers will block the page from being loaded in an iframe.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
0

Actually page gets loaded with some javascript and json data, however javascript logic first check if page is the main page or not, if its not than it doesnt render the DOM object or web page.

best way to validate is to right click on the iframe where google should open and click on view source of that iframe, you will see the google java script code. hence iframe works fine on w3schools but google restricts itself to be open from iframe for some reasons.

leoismyname
  • 407
  • 6
  • 11