How to close a window.open

后端 未结 2 1860
一个人的身影
一个人的身影 2021-01-26 16:42

I know that you can close a window.open with window.close but is there another way. I have a popup that opens facebook connect and i want to shut the popup whenever the user con

相关标签:
2条回答
  • 2021-01-26 17:13

    You can use close() method of created popup that is returned by the open() method as object:

    var myPopup;
    
    $(document).ready(function(){
        $('#signin_menu a').click(function (){
    
            myPopup = window.open(
                $('#signin_menu a').attr("href"),
                'mywindow',
                'width=850,height=400');
    
            return false;
        });
    })
    

    To close do the following:

    myPopup.close();
    
    0 讨论(0)
  • 2021-01-26 17:20

    you can use the below

    window.close();
    
    0 讨论(0)
提交回复
热议问题