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

后端 未结 4 1213
别跟我提以往
别跟我提以往 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:24

    Error messages don't get any clearer than this:

    "Scripts may close only the windows that were opened by it."
    

    If your script did not initiate opening the window (with something like window.open), then the script in that window is not allowed to close it. Its a security to prevent a website taking control of your browser and closing windows.

提交回复
热议问题