Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iframe with external page not working

Tags:

I'm tring to embed a webpage in an iframe, but it doesn't work at all. internal pages with relative path are displayed normally. but this simple code doesn't work:

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

the place that supposed to show the iframe is just empty. i looked in the page source and there is nothing after

How can this be?

like image 393
Moshe Shaham Avatar asked Feb 06 '12 09:02

Moshe Shaham


People also ask

Why is iframe not displaying content?

If the primary domain for your website is secure with SSL (https://) but the source URL for your Iframe is not, your website will display an error, or simply not display the content. To fix this, you'll need to update the Source URL for your Iframe content with the secure (https://) version.

Why some websites are not opening in iframe?

if its value is "DENY or SAMEORIGIN", then you can not load those website in the iframes. DENY = No one can load the website in iframe. Even the same domain page wont be able to load. SAMEORIGIN = only a page which is in same domain can load this website in iframe.

How do I fix an iframe refused connection?

Most probably web site that you try to embed as an iframe doesn't allow to be embedded. You need to update X-Frame-Options on the website that you are trying to embed to allow your Power Apps Portal (if you have control over that website).

How do I open an iframe external link?

You can embed an iframe in a page that is inside another iframe on another web page. When you set the target attribute to _parent, the link will open in the web page that is holding the iframe. In most situations with iframes, this target will open links in the same way that the _parent target does.


2 Answers

Google uses an X-FRAME-OPTIONS HTTP header to disallow putting their pages in iframes: https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header

Almost all modern browsers will refuse to put pages with this HTTP header in an iframe. There's nothing you can do about that.

like image 131
Daan Avatar answered Oct 19 '22 23:10

Daan


Because the internal page had do something to prevent to be put in iframe.

Maybe a piece of javascript like that

if (window.top != window.self) {window.top.location = window.self.location;} 
like image 26
horsley Avatar answered Oct 20 '22 00:10

horsley