May 06, 2021 JavaScript
The window.screen object contains information about the user's screen.
This information can be used to understand the basic configuration of the client hardware.
Window.screen objects can be written without the prefix window.
Some properties:
screen.availWidth - available screen width
screen.availHeight - Available screen height
The screen.availWidth property returns the width of the visitor's screen, in pixels, minus interface features, such as the window taskbar.
Return the available width of your screen:
The above code output is:
The screen.availHeight property returns the height of the visitor's screen, in pixels, minus interface features, such as the window taskbar.
Return the available height of your screen:
The above code will output:
Check out our reference manual for JavaScript Screen objects, which provides all the properties you can use with Screen objects.