JavaScript window.close() Method Last Updated : 25 Jul, 2024 Summarize Suggest changes Share Like Article Like Report JavaScript window.close() method, is used for closing a certain window or tab of the browser which was previously opened by the window.open() method.Syntax:window.close();Parameters: This method does not accept any parameters.Example: In this example, at first we will use the window.open() method to open a new window, assign its value to a temporary variable, and use that variable with the window.close() method to close that page. HTML <h2>Window.close() object GFG</h2> <button class="btn open">Open</button> <button class="btn close">Close</button> <script> var newPage = document.querySelector('.open') .addEventListener('click', function () { newWindow = window.open('https://www.geeksforgeeks.org/', '_blank', 'width=400,height=400 top=100,left=800'); }); document.querySelector('.close') .addEventListener('click', function () { newWindow.close(); }); </script> Output:Supported Browsers:Google Chrome 1 and aboveEdge 12 and aboveFirefox 1 and aboveInternet Explorer 4 and above Opera 3 and aboveSafari 1 and aboveJavaScript is best known for web page development but it is also used in a variety of non-browser environments. You can learn JavaScript from the ground up by following this JavaScript Tutorial and JavaScript Examples.HTML is the foundation of web pages and is used for webpage development by structuring websites and web apps. You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript. Advertise with us Next Article Node.js fs.close() Method I iamgaurav Follow Similar Reads JavaScript window.open() Method The Javascript window.open() method is used to open a new tab or window with the specified URL and name. It supports various parameters that can be used to specify the type and URL location of the window to be opened.Syntax:window.open(url, windowName, windowFeatures)Parameters: It has the following 3 min read Javascript Window Open() & Window Close() Method The Javascript Window.Open() method is used to open the web pages into a new window or a new tab. It depends on the browser settings and the values assigned to the parameter. Syntax:window.open(URL, name, specs, replace)Parameters: This method accepts four parameters as mentioned above and described 3 min read Node.js fs.close() Method The fs.close() method is used to asynchronously close the given file descriptor thereby clearing the file that is associated with it. This will allow the file descriptor to be reused for other files. Calling fs.close() on a file descriptor while some other operation is being performed on it may lead 3 min read Java - Close AWT Window Java Abstract Window Toolkit (AWT) is a package that creates dynamic and interactive Graphical User Interfaces (GUIs) for Java applications. The ability to properly close AWT windows is an important aspect of developing user-friendly AWT applications. In this article, we will look into different met 7 min read Node.js fs.Dir.close() Method The fs.Dir.close() method is an inbuilt application programming interface of class fs.Dir with in File System module which is used to close the directory's underlying resource handle asynchronously. Syntax:Â const dir.close() Parameter: This method does not accept any parameter.Return Value: This me 2 min read SVG Window.closed Property The SVG Window.closed property indicates whether the referenced window is closed or not. Syntax: const isClosed = windowRef.closed Return value: This property returns the boolean value of the event element. Example 1: In this example, we will use onclick event. html <!DOCTYPE html> <html 2 min read Article Tags : JavaScript Web Technologies JavaScript-Methods Like