Manipulating User Screen in JavaScript

JavaScript can be used to manipulate the User device screen. JavaScript window.screen object provides the useful information about the user screen.

window.screen object has following important properties

  •     screen.width  Return the User device screen width
  •     screen.height Return the User device screen width
  •     screen.availWidth Return the User device available screen width
  •     screen.availHeight Return the User device available  screen height
  •     screen.colorDepth Return the User device screen color depth
  •     screen.pixelDepth Return the User device screen pixel depth


Below the code example of showing all of the above properties.


These are very useful information which can be used in responsive design of the Web and applications.