window.close() behavior
Calling window.close() works only when the script opened the target window itself. Browsers ignore the call for top-level windows the user opened directly. This restriction has been consistent since the early 2000s and remains in current Chrome, Firefox, Safari, and Edge.
Related window methods
The same W3Schools reference page lists open() for creating new windows, alert() and confirm() for modal dialogs, and prompt() for text input. Each method returns a value or window reference the script can use. All are synchronous and block the calling thread until dismissed.
Practical note
Use window.close() in popup flows your code controls, such as OAuth callbacks or print dialogs. Do not rely on it for general navigation. For single-page applications, prefer router navigation over window manipulation.