简体   繁体   中英

Close Pop-up and refresh parent window not working

All of a sudden my simple javascript code to close a pop-up and refresh the parent window stopped working in Google Chrome browsers on iPad and iPhone devices. It still works if we use the built in safari browser on the same devices.

Any reason why someone could see this a wouldn't work in chrome? And by not working I mean that the pop-up closes and the parent window doesn't refresh.

 <!---Close -Reload The Window --->
    <script type="text/javascript">
        function CloseWindow() {
            window.close();
            window.opener.location.reload(true);
        }
    </script>

            <a href="" onClick="javascript: return CloseWindow();">Signature Captured - Close Window</a>

you cant refresh page after close the window

<script type="text/javascript">
        function CloseWindow() {   
            window.opener.location.reload(true);
            window.close();
        }
    </script>

another Type , I test it, it works. If you get the problem again, your browser may cause the problem.

 <script type="text/javascript">
        function CloseWindow() {
            window.close();
            window.opener.location = window.opener.window.location;
        }
    </script>

we located this function in the main page and call it from the popup window and it works we commented out this post - but i don't see any reference to the setTimeout we did.. so I decided to point this out and maybe it will help someone else

main page

function reloadPage() {
 if (navigator.userAgent.indexOf(' Chrome') > -1) {
    setTimeout(function () {
        location.reload(true);
    }, 0);
 } else {
    location.reload(true);
 }
}

popup page

window.top.opener.reloadPage();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM