我遇到了类似的问题。在我的asp .net应用程序中,我使用window.open打开一个弹出窗口,该应用程序应与iPad兼容。当我在Windows 7的PC上使用IE、Chrome、FireFox和Safari时,成功返回了值。
不幸的是,在通过iPad访问应用程序时,相同的代码在Safari中失败。在新窗口打开时,domObject被提示,而不是在新窗口关闭时提示返回的值。
以下是代码。
父窗口:
enter code here
<script type="text/javascript">
function modalWin() {
if (window.showModalDialog) {
retVal = window.showModalDialog("About.aspx", "name", "dialogWidth:255px;dialogHeight:250px");
alert(retVal);
}
else {
retVal = window.open('About.aspx', 'name', 'height=255,width=250,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no ,modal=yes');
alert(retVal);
}
}
</script>
//HTML
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<a title="Test New Popup" onclick="modalWin();">New Popup for all browsers.</a>.
</asp:Content>
新页面:
<script type="text/javascript">
function closeIt(tempValue) {
window.returnValue = tempValue;
window.close();
}
</script>
<input id="btnButton1" value="btnButton1" type="button" title="Press it to Close" onclick="closeIt('btnButton1');" />
<br />
<input id="btnButton2" value="btnButton2" type="button" title="Press it to Close" onclick="closeIt('btnButton2');" />
<br />
<input id="btnButton3" value="btnButton3" type="button" title="Press it to Close" onclick="closeIt('btnButton3');" />