🖥️ Screen Object
Last Updated: 26th October 2025
- The Screen Object contains information about the user’s display screen.
- It is part of the Browser Object Model (BOM) and helps you access details like screen height, width, and color depth.
Hinglish Tip 🗣:
screenobject batata hai aapke monitor/mobile ki screen ke “size aur color quality” ke baare me.
🧩 Common Properties of screen
| Property | Description | Example |
|---|---|---|
| screen.width | Returns total width of the screen in pixels | screen.width |
| screen.height | Returns total height of the screen in pixels | screen.height |
| screen.availWidth | Available width (excluding OS taskbar, etc.) | screen.availWidth |
| screen.availHeight | Available height (excluding OS taskbar, etc.) | screen.availHeight |
| screen.colorDepth | Number of bits used to display one color | screen.colorDepth |
| screen.pixelDepth | Number of bits per pixel (same as colorDepth in most browsers) | screen.pixelDepth |
Example
console.log("Total Width:", screen.width);
console.log("Total Height:", screen.height);
console.log("Available Width:", screen.availWidth);
console.log("Available Height:", screen.availHeight);
console.log("Color Depth:", screen.colorDepth);
console.log("Pixel Depth:", screen.pixelDepth);