Problem with iframe

1

I try to open a simple link in an iframe, and it throws that error:

  

Refused to display in a frame because it is 'X-Frame-Options' to 'sameorigin'

This is the complete code:

<html>
  <head>
    <meta charset="utf-8" />
    <title>Testing Page</title>
  </head>
  <body>
    <iframe width="400" height="215" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.google.com.br"> </iframe><br />
  </body>
</html>
    
asked by anonymous 18.05.2018 / 21:11

1 answer

4

Nothing is wrong with your code, the problem is the security of the server you are calling.

The site "google.com" has defined that it can not be opened in iframes of other domains other than "google.com".

To use an iframe you have to import a page of your own, or some less secure site, such as bitbucket for example:

<html>
<head>
    <meta charset="utf-8" />
    <title>Testing Page</title>
</head>

    <body>
            <iframe width="400" height="215" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://bitbucket.com"> </iframe><br />
    </body>

</html>
    
18.05.2018 / 21:30