JavaScript Window Screen


The window.screen object contains information about the user's screen.


Window Screen

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

some properties:

  • screen.availWidth - Available screen width

  • screen.availHeight - Available screen heights


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.

Example

returns the available width of your screen:

<script>
document.write("Available Width: " + screen.availWidth);
</script>

the above code output is:

Available width: 1536

Try It! 


Window Screen usable height

The screen.availHeight property returns the height of the visitor's screen, in pixels, minus interface features, such as the window taskbar.

Example

return the available height of your screen:

<script>
document.write("Available height: "+ screen.availHeight);
</script>

The above code will output:

Available height: 824

Try It! 


All screen property examples