Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

JavaScript Window Screen


May 06, 2021 JavaScript


Table of contents


JavaScript Window Screen


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

Window.screen objects can be written without the prefix window.

Some properties:

  • screen.availWidth - available screen width

  • screen.availHeight - Available screen height


Window Screen available width

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:

<script>

Document.write ("Available Width:" + Screen.AvailWidth;

</script>

The above code output is:

Available width: 1920

Try it out . . .



Window Screen available height

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:

<script>

Document.write ("available height: + screen.availheight);

</script>

The above code will output:

Available height: 1040

Try it out . . .



Related articles

Check out our reference manual for JavaScript Screen objects, which provides all the properties you can use with Screen objects.