Content you want the user to see goes here.

Click ...">

How to show a webpage nested in a div?

I have some simple HTML

<div id="overlay"> <div> <p>Content you want the user to see goes here.</p> Click here to [<a href='#' onclick='overlay()'>close</a>] <div> <object type="text/html" data="http://google.com"></object> </div> </div> </div> 

I get an error like,

This content cannot be displayed in the frame.

How to show webpage inside div?

0
source share
3 answers

www.google.com , and on other sites use the X-Frame-Options HTTP header , which indicates that attachment is allowed only from the same source:

 x-frame-options:SAMEORIGIN 

Browsers respect this title and prevent the embedding of the site.

+2
source

You must use an <iframe> to display the page inside the page.

 <iframe src="http://example.com"></iframe> 
0
source

The reason for this is that Google sends the response header "X-Frame-Options: SAMEORIGIN" . This setting prevents the browser from displaying iFrames that are not hosted in the same domain as the parent page.

X-Frame-Options Response Header

Here is the work:

Working script

 <iframe id="if1" width="100%" height="254" style="visibility:visible" src="http://www.google.com/custom?q=&btnG=Search"></iframe> 

Here is another workaround:

How to load HTML site code using jquery?

Good luck

0
source

Source: https://habr.com/ru/post/1204192/


All Articles