Issue with window.close and chrome

后端 未结 6 669
长情又很酷
长情又很酷 2020-11-30 02:41

Im trying to close a child window with javascript and in firefox everything works fine but in chrome the window doesnt close

here is what im using

$(         


        
6条回答
  •  醉梦人生
    2020-11-30 03:10

    If previously you open some other window by window.open()

    This don't work:

    window.open(...)
    window.open('', '_self', '');
    window.close();
    

    But work:

    window.open(...);
    setTimeout(function(){
        window.open('', '_self', '');
        window.close();
    }, 100);
    

提交回复
热议问题