window.close() doesn't work - Scripts may close only the windows that were opened by it

后端 未结 4 1209
别跟我提以往
别跟我提以往 2020-11-29 11:50

I\'m having a problem always when I\'m trying to close a window through the window.close() method of the Javascript, while the browser displays the below messag

4条回答
  •  迷失自我
    2020-11-29 12:29

    You can't close a current window or any window or page that is opened using '_self' But you can do this

    var customWindow = window.open('', '_blank', '');
        customWindow.close();
    

提交回复
热议问题