Windows are the most important interface elements in the browser, and JavaScript offers many ways to manipulate them.
1. Properties and methods of the window object.
A browser (regardless of the name or manufacturer) is displayed in a window and everything the user does with the browser runs inside that window. All elements of a web page are also contained in that window. The “Window” object is considered the highest hierarchical object in the hierarchy of client-side JavaScript objects and contains all the other objects on the client side, except for the “navigator” object, conceptually different, not being a visual element. As in practice, you can work with multiple open windows at once, so you can also work with multiple “Window” objects, one for each window.
The “Window” object is created automatically when a new browser window opens. Be careful not to confuse the distinct browser windows with the frames, which are also referred to as windows, being in fact subpages of the browser window. Like other objects, and “Window” has a number of properties and methods. Being the object of the highest level, some of these can be called or referenced without using the phrase “window.”
The window object has the following properties:
– closed – Specifies whether the “window” instance has been closed
– crypto – allows access to Netscape encryption features
– defaultStatus – specifies the default message in the window status bar
– document – lists all information about the document in this window
– frames – lists all the frame information in this window
– history – lists the URLs visited by the user in the current window
– innerHeight – contains the height in pixels of the area displayed in the current window
– innerWidth – contains the pixel width of the displayed area in the current window
– length – represents the number of frames in the current window
– location – contains the current URL loaded in the browser
– locationbar – refers to the browser’s location bar
– locationbar.visible – contains the boolean value that indicates whether the location bar on the user’s browser is visible
– Menus – refers to the browser menu bar
– menubar.visible – contains the boolean value that indicates whether the menu bar on the user’s browser is visible
– name – contains the window name
– offscreen-buffering – contains a boolean value that allows us to determine whether a window update is executed in an off-screen buffer
– opener – contains the name of the window from which a secondary window was opened
– outerHeight – contains the height in pixels of the surface outside the current window
– outerWidth – Contains the width in pixels of the surface outside the current window
– pageXOffset – contains the X coordinate of the current window
– pageYOffset – contains the Y coordinate of the current window
– parent – refers to the highest level window that displays the current frame
– personalbar – mentions information about the browser’s personal bar
– personalbar.visible – contains the boolean value that indicates whether the user bar is visible on the user’s browser
– screenX – refers to the X coordinate of the browser, on the left edge of the window (Netscape)
– screenY – refers to the browser’s Y coordinate at the top of the window
– scrollbars – refers to the browsers of the browser
– scrollbars.visible – contains the boolean value that indicates whether the scrollbars on the user’s browser are visible
self – refering to the current window
– status – refers to the message on the window status bar
– statusbar – refers to the browser status bar
– statusbar.visible – contains the boolean value that indicates whether the user’s browser status bar is visible
– toolbar – refers to the browser toolbar
– Toolbar.visible – contains the boolean value that indicates whether the user’s browser toolbar is visible
– top – refers to the highest level window that displays the current frame
– window – refers to the current window
The window object has the following methods:
– atob () – decodes a string that has been encoded on the base 64
– alert () – displays a warning window with a specific text string
– back () – loads a previous page visited in the current window
– blur () – disables a window
– btob () – encodes a string on the base 64
– captureEvents () – sets the window to capture all events of a specified type
– clearInterval () – clears the set interval with the setInterval () method
– clearTimeout () – delete the set break with the “setTimeout ()” method
– close () – close it