English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
close()The function of the method is: close the current window or call the window that opened it.
Only allowed to usewindow.open()The method is called by the window opened by the script.
window.close()
var popupWindow; // Function to open a new window function windowOpen() { popupWindow = window.open("https://www.oldtoolbag.com", "_blank"); } // Function to close the opened window function windowClose() { if (popupWindow) { popupWindow.close(); } }Test See </›
All browsers fully support the close() method:
Method | |||||
close() | Yes | Yes | Yes | Yes | Yes |
Return Value: | None |
---|
Window (Window) Reference:open() Method
Window (Window) Reference:closed() property