Close browser's new open window tab

 JavaScript never allows developers to close windows opened by the user. This is due to some security issues. Therefore, programmers can only close browser windows opened with JavaScript's open() method.

grammar

You can use the close() method to close the browser window according to the syntax below .

let new_window = window.open(URL, width, height);
new_window.close();

In the above syntax, we are storing the returned value in the new_window variable when creating a new window. Afterwards, we use the close() method to close the newly opened window.

Guess you like

Origin blog.csdn.net/qq_36657291/article/details/130056010