iframe与外部页面不起作用 [英] iframe with external page not working
问题描述
< iframe src =http://www.google.com/ >< / iframe中>
应该显示iframe的地方只是空的。
这怎么可能?
Google使用X-FRAME-OPTIONS HTTP标头禁止将页面放入iframe:
https://developer.mozilla.org/zh/The_X-FRAME-OPTIONS_response_header
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?
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.
这篇关于iframe与外部页面不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!