Putting mobile Google into an iframe does not work

2019-07-05 08:49发布

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?

标签: html iframe
1条回答
干净又极端
2楼-- · 2019-07-05 09:09

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

查看更多
登录 后发表回答