Search code examples
javascripthtmlinternet-explorer-11

When you open the Alert window in the Popup window, the popup window disappears


For IE11.

If you open the alert window in the popup window of A, the popup window disappears once, and when you check again, the popup window appears.

For other browsers (Chrome, FF, Edge), the alert appears in the popup window.

I wonder if there is a solution.


Solution

  • Can't reproduce the problem on my side. According to your description, I create a sample using the following sample code, it seems that everything works well:

    code in main page:

    <button onclick="myFunction()">Open new window</button>
    
    <script>
        function myFunction() {
            window.open("popuppage.html","_blank","wight=900px, height=600px")
        }
    </script>
    

    code in popuppage.html:

    <head>
        <meta charset="utf-8" />
        <title></title>
        <script>
            function myfunction() {
                alert("Hello");
            }
        </script>
    </head>
    <body>
        <a id="btnshowalert" href="#" onclick="return myfunction();" > show alert</a>
    
    </body>
    

    The result as below:

    enter image description here

    Please try to clear IE browser cache and history, then create a new page to test above code or re-test your code. If still not working, you could try to reset Internet Explorer settings and share your code.