On clild window close cannot send value to parent window in JavaScript for iPad Safari

核能气质少年 提交于 2019-12-11 04:43:06

问题


I need to open a new popup window/tab using window.open method of javascript and on close of the new tab/popup window have to return some values from closing window to parent window. When I open a popup suing window.open in my asp .net application which is supposed to be compatible with iPad. Value has successfully been returned when I use IE, Chrome, FireFox and Safari (on PC with windows 7).

Unfortunately the same code fails in Safari when I access the application through iPad. On iPad domObject is prompted on new window open instead of prompting returned value on new window close.

Below is the code. Parent Window:

    <script type="text/javascript">

        function modalWin() {       
                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>
Popup window or new tab:

    <script type="text/javascript">
        function closeIt(tempValue) {
            window.returnValue = tempValue;
            window.close();
        }
    </script>

    //HTML:
<input id="btnButton1" value="btnButton1" type="button" onclick="closeIt('btnButton1');" />
<br />
<input id="btnButton2" value="btnButton2" type="button" onclick="closeIt('btnButton2');" />
<br />
<input id="btnButton3" value="btnButton3" type="button" onclick="closeIt('btnButton3');" />

来源:https://stackoverflow.com/questions/10535439/on-clild-window-close-cannot-send-value-to-parent-window-in-javascript-for-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!