【发布时间】:2012-03-23 02:28:50
【问题描述】:
这是一个奇怪的功能,直到最近此功能运行良好,并且仍在其他站点上运行。
我正在使用 iframe 来允许用户在页面上启动下载,而无需使用 asp.net 提交实际页面本身:
<iframe id="ifrDownload" name="ifrDownload" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" style="display: none;" src="Download.aspx"></iframe>
但是最近在尝试下载时,我在访问 iframe 时收到臭名昭著的“权限被拒绝访问属性‘文档’错误,显然本地文件与父文件在同一个域中,所以我不确定为什么会这样,但我确信这与我在 Firebug 中检查页面时发生的奇怪事情有关。
正常运行的网站在检查时显示以下 iframe 内容:
<iframe id="ifrDownload" scrolling="no" frameborder="0" src="Download.aspx" style="display: none;" marginheight="0" marginwidth="0">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> </title>
</head>
<body>
<form id="downloadForm" action="Download.aspx" method="post" name="downloadForm">
<div>
<input id="__VIEWSTATE" type="hidden" value="/wEPDwULLTExNjE3Nzc3MzlkZMnbcG6xJn5Jp/GA7fqNd/QyKuTC" name="__VIEWSTATE">
</div>
<div>
<input id="__EVENTVALIDATION" type="hidden" value="/wEWBgLTi7KCAQLnqqEBAuXC+6cLAoPKgZYKAvWdu+YGApj5qL4FFEFbauoxzxy+93iYHGZSO7dPLso=" name="__EVENTVALIDATION">
</div>
<div>
<input id="downloadButton" type="submit" style="display: none;" value="Confirm Download" name="downloadButton">
<input id="attachmentIdField" type="hidden" name="attachmentIdField">
<input id="tableFieldId" type="hidden" name="tableFieldId">
<input id="filenameField" type="hidden" name="filenameField">
<input id="whichField" type="hidden" name="whichField">
</div>
</form>
</body>
</html>
</iframe>
但非工作站点只是显示:
<iframe id="ifrDownload" scrolling="no" frameborder="0" src="Download.aspx" style="display: none;" marginheight="0" marginwidth="0" name="ifrDownload">
<html>
<head></head>
<body></body>
</html>
</iframe>
两个站点的 Download.aspx 文件几乎相同,并且与两个站点的父页面位于同一目录中,我只能认为我无意中将一些代码放在了破坏 iframe 工作方式的地方。
有什么建议吗?我已经对 HTML 进行了 Linted,一切看起来都很好。
【问题讨论】: