0

I have a very basic html, supposingly

<html>
<body>
    <iframe src="http://www.google.com">
        <p>Your browser does not support iframes.</p>
    </iframe>
</body>
</html>

When I render the page with Google/Yahoo as a source address there is no display. This is what I see in firebug

<iframe src="http://www.google.com">
    <html>
        <head></head>
        <body></body>
    </html>
</iframe>

If I am doing something wrong please correct else please provide any authentic documentation if search englines have blocked iframes. Would really appreciate.

p.s You can try the above example on W3Schools too.

Zain Khan
  • 3,753
  • 3
  • 31
  • 54

3 Answers3

2

You cannot bypass it in browsers , they will simply refuse to display websites in iframe that send a
X-Frame-Options header with DENY or SAMEORIGIN . It doesn't even come down to javascript. For more read on ClickJacking and X-Frame-Options

0

With javascript you can easily find out if your site is displayed inside a frameset/IFrame or if it is stands alone:

<script type="text/javascript">if(self!=top){/*I am framed*/}</script>

Probably Google has this code in one of its scripts, and when it finds out that its site is inside a foreign frame, it deletes its content.

With the same simple trick a html page can break out of every frame:

<script type="text/javascript">
   if(self!=top){
      top.location.replace(self.location.href);
   }
</script>

If you want to try out this break-free-trick, replace in your code www.google.com with the url of my site: wissen.schoelnast.at (it is in German)

tripleee
  • 175,061
  • 34
  • 275
  • 318
Hubert Schölnast
  • 8,341
  • 9
  • 39
  • 76
0

what google says about iframe, read Here

refer to Avoid iFrames - or link to their content separately...

sha256
  • 3,029
  • 1
  • 27
  • 32