我有一小段代码,我想加载嵌入在我的一个 aspx 页面中的另一个网站的一部分:
<tr>
<td style="padding-left:15px;">
<iframe src="http://www.google.com/" width="210" height="100" /></iframe>
</td>
</tr>
当我在 IE 中查看页面时,框架有以下警告文本:
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.
但是,在任何情况下,google.com 或任何其他外部页面都不会加载。 iframe 是一个非常简单的标记...是否明显缺少某些内容,或者 ASP.NET 强加了一些限制?
提前致谢。
最佳答案
阅读警告文字 - 它说的是实话。发布商 (google) 不允许在 iframe 或框架中托管其网站。 Google 通过添加现代浏览器将并且应该遵守的 http header “X-FRAME-OPTIONS: DENY”来实现此目的。
https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header
关于asp.net - iframe 未加载 ASP.NET 应用程序中的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9284841/