html – Iframe not show all websites-ThrowExceptions

Exception or error:

In http://localhost i have put in the index.html file this:

<iframe src="https://google.com" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;">
    Your browser doesn't support iframes
</iframe>

But it just shows the sad face.

Any help would be good

Thanks

How to solve:

Google.com prevents framing via the X-Frame-Options header.

Most large sites will do the same.

It’s also possible to use a Content Security Policy to prevent framing.

###

If you open the JavaScript console in your browser you should see an error something like this

Refused to display ‘https://www.google.com/‘ in a frame because it set ‘X-Frame-Options’ to ‘sameorigin’.

That means google’s server is telling your browser not to allow displaying google.com in an iframe

Leave a Reply

Your email address will not be published. Required fields are marked *