【发布时间】:2018-05-27 11:23:08
【问题描述】:
我的带有iframe 的HTML 页面在按钮单击时显示asp.net 网络表单。两个页面(html 和 webform)都托管在我们的 Intranet 中;它们是相同的 IP 但不同的端口。
我不断收到SecurityError: Blocked a frame with origin...,所以我最终将X-Frame-Options: SAMEORIGIN 添加到两个IIS 文件夹中。我可以在 Chrome 开发人员工具 中看到这两个,但我仍然收到错误消息。
我了解 CORS 错误,但 iframe 在 HTML 中。那么为什么 iframe 加载后 iframe 会更改为 不同的域?我只有在加载网络表单后才会收到错误消息。
有没有解决办法?谢谢。
无论如何,这是 HTML:
<html class="no-js" lang="">
<head>
</head>
<body>
<div id="storeTable" style="width: 900px; height: 200px;">
<iframe id="retailframe" src="" width="900px" height="800px" scrolling="no" allowTransparency="true" frameborder="0" ></iframe>
</div>
<input type="button" value="Capacity Chart" onclick="CapacityChart();">
<script>
function CapacityChart()
{
var doc = document.getElementById('retailframe').contentWindow.document;
doc.open();
doc.write('Test');
doc.close();
var storeSite = "http://10.12.34.83:88/Grid.aspx";
var store = document.getElementById('retailframe');
store.src = storeSite;
}
</script>
</body>
</html>
【问题讨论】:
标签: javascript html asp.net iframe iis-7