Putting mobile Google into an iframe does not work

2019-07-05 08:50发布

问题:

Behind the following link is the mobile view of Google: Google's mobile site.

I tried to put it in an iframe on my website, but it doesn't work.

<iframe id="google_search" src="http://m.google.at/search?hl=de&safe=on&q=stackoverflow" style="width: 400px; height: 600px; overflow:scroll; border: 1px solid black;"></iframe>

All I get is an emty iframe. Why?

回答1:

I would suspect that Google is sending the X-FRAME-OPTIONS header set to deny. This prevents the page from loading in a frame in IE8+ and newer versions of FireFox, Opera, and Chrome (the exact version numbers escape me at the moment).

This is usually done to combat ClickJacking. The IEBlog has a great article on this: IE8 Security Part VII: ClickJacking Defenses



标签: html iframe