locked
window.open() opens a window, but it vanishes. Opens 2nd time RRS feed

  • Question

  • User-173333858 posted

    Hi, My asp application opens another window like this:

    function OpenEDEP() {            
                if ((newWindow == null) || (newWindow.closed)) {
                    newWindow = window.open('./EDEP/LandingForm.aspx?LastLogin=<%=this.Last_Login%>&FullName=<%=this.FullName%>', 'EDEP_window');
                    EDEPOpen = 1;
                }            
            }

    Recently, on the 1st try, a new window opens for a split second and closes. Then when the button is clicked a 2nd time, it opens. I assume I need to null the newWindow value after t is closed? But what could be the reason.

    Wednesday, September 23, 2020 1:52 PM

All replies

  • User1535942433 posted

    Hi RDesh,

    Accroding to your description,I have created a test of your codes and it works.

    Could you tell us what your newWindow?Could you post your full codes to us?

    Bellow is my test codes:

     <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="OpenEDEP()" />
     <script>
            function OpenEDEP() {
                var newWindow = null;
                if ((newWindow == null) || (newWindow.closed)) {
                    newWindow = window.open("2170938.aspx");
                    EDEPOpen = 1;
                }   
            }
        </script>

    Result:

     

    Best regards,

    Yijing Sun

    Thursday, September 24, 2020 6:31 AM