Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google homepage will not load in an iframe

Tags:

iframe

Really cannot understand why yahoo iframe works but the google one does not:

<!DOCTYPE html><html><body>
<iframe frameborder="0" src="http://www.yahoo.com"></iframe>
<iframe frameborder="0" src="http://www.google.com"></iframe>
</body></html>

any ideas?

like image 740
iwek Avatar asked Dec 15 '11 17:12

iwek


People also ask

Why some websites are not opening in iframe?

You have to check for HTTP response header X-Frame-Option of those sites. 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.

Why is iframe not working in Chrome?

Why iFrame is not working in Chrome? It's really a simple issue here because Chrome is usually blocking iFrame and that's the main reason you're getting the error. However, iFrame may also be blocked from your Internet Options, by your antivirus or by an add-on you just installed in Chrome.

Can you embed Google in an iframe?

Google Custom Search no longer supports using an iframe to host a custom search engine on your page. To host your search engine on your own page (and ensure that you always have the most up-to-date features), you must add the Google Custom Search code to your site.

Why do websites refuse to connect in iframe?

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).


2 Answers

From http://msdn.microsoft.com/en-us/library/cc288472(v=vs.85).aspx#search

Clickjacking Defense: Some hackers try to trick users into clicking buttons that appear to perform safe or harmless functions, but instead perform unrelated tasks. Clickjackers embed malicious code or "redress" the user interface by using transparent frames that overlay specific UI elements with misleading text and images. To help prevent clickjacking, Web site owners can send an HTTP response header named X-Frame-Options with HTML pages to restrict how the page may be framed.

X-Frame-Options: Deny

If the X-Frame-Options value contains the token Deny, Internet Explorer 8 prevents the page from rendering if it is contained within a frame. If the value contains the token SameOrigin, Internet Explorer will not render the page if the top level-browsing-context differs from the origin of the page containing the directive. Blocked pages are replaced with a "This content cannot be displayed in a frame" error page.

like image 171
wkm Avatar answered Sep 23 '22 21:09

wkm


Using IE8, I get the following message in the Google iframe

This content cannot be displayed in a frame

To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.

Looks like Google uses some code to prevent it's content from being displayed in an iframe

EDIT:

I found a decent explanation here: http://forums.asp.net/p/1733782/4654025.aspx/1?I+am+gettignthe+following+error+in+asp+net+with+facebook+app+early+it+is+working+fine+Once+i+click+on+Open+this+content+in+a+new+window+

like image 40
JOpuckman Avatar answered Sep 25 '22 21:09

JOpuckman