Issue with window.close and chrome

后端 未结 6 631
长情又很酷
长情又很酷 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 02:52

    top.window.close() works for me. Tested on IE, FF, Chrome, Safari and Opera.

    0 讨论(0)
  • 2020-11-30 02:57

    Something like this should also work:

    setTimeout(function() {
        window.close();
    },50);
    
    0 讨论(0)
  • 2020-11-30 02:57

    This worked for me

    var win = window.open("about:blank", "_self");
    win.close();
    
    0 讨论(0)
  • 2020-11-30 03:02

    I know this question is old, but I ran into the same problem. This worked for me:

    window.open('', '_self', ''); //bug fix
    window.close();
    
    0 讨论(0)
  • 2020-11-30 03:05

    I think it's working in Chrome Kiosk ( Fullscreen ) mode. Tried successfully.

    0 讨论(0)
  • 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);
    
    0 讨论(0)
提交回复
热议问题