check window open

前端 未结 1 1102
被撕碎了的回忆
被撕碎了的回忆 2021-01-24 08:07
var windowUrl = \"\";
var windowName = \"mywin\";
var w = window.open(windowUrl, windowName, windowSize);
w.document.write(html);
w.document.close();

T

相关标签:
1条回答
  • 2021-01-24 09:00

    Try the following:

    <script type="text/javascript">
    function loadUniquePage(page) 
    {
        if (opener && !opener.closed) {
            opener.focus();
        } else {
            var myWin = window.open(page,'','width=800,height=600');
            opener = myWin;
        }
    }
    </script>
    

    also take a look at this question - JavaScript window.open only if the window does not already exist

    also take a look on the link provided by @Aram Kocharyan:
    https://developer.mozilla.org/en/DOM/window.closed

    0 讨论(0)
提交回复
热议问题