Home > Software engineering >  Why does chrome close a window opened from a non-script with window.close()?
Why does chrome close a window opened from a non-script with window.close()?

Time:11-10

I don't think it did not close before.

This is the result of testing with the attached html.

Close. chrome 107.0.5304.89(Official Build)
Close. Edge 107.0.1418.35 (Official Build)(64bit)
Not close. Firefox 106.0.5(64bit)

This document says it will not be closed.
Window.close()

<html>

<body>
  <script>
    window.close();
  </script>
</body>

</html>

CodePudding user response:

I've checked some Chromium issue threads, and it seems that Chromium browsers follow different logic from Firefox.

In short, if a tab has only 1 item in backward/forward history, window.close() works and closes the tab. But it is not counted as an issue, partly because they think

This is a useful option for automated testing. It allows you to set up test pages that clean up themselves when they're done.

Reference link: https://bugs.webkit.org/show_bug.cgi?id=22070 https://codereview.chromium.org/22929032/#ps9001

  • Related