
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
JavaScript BOM Window Screen
The JavaScript BOM Window screen contains the information about the client’s screen.
The BOM window screen properties are −
Properties | Description |
---|---|
screen.width | Return the user screen width in pixels. |
screen.height | Return the user screen height in pixels. |
screen.availWidth | Returns the user screen width in pixels without taking into account the interface features. |
screen.availHeight | Returns the user screen height in pixels without taking into account the interface features. |
screen.colorDepth | Returns the bits used to display one color |
screen.pixelDepth | Retrurns the screen pixel depth |
Following is the code for the JavaScript BOM Window screen −
Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <style> body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 18px; font-weight: 500; color: blueviolet; } </style> </head> <body> <h1>JavaScript BOM Window Screen</h1> <div class="result"></div> <button class="Btn">CLICK HERE</button> <h3>Click on the above button to get information about your screen</h3> <script> let resultEle = document.querySelector(".result"); document.querySelector(".Btn").addEventListener("click", () => { resultEle.innerHTML = 'screen.width = '+screen.width+'<br>'; resultEle.innerHTML += 'screen.height = '+screen.height+'<br>'; resultEle.innerHTML += 'screen.availWidth = '+screen.availWidth+'<br>'; resultEle.innerHTML += 'screen.availHeight = '+screen.availHeight+'<br>'; resultEle.innerHTML += 'screen.colorDepth = '+screen.colorDepth+'<br>'; resultEle.innerHTML += 'screen.pixelDepth = '+screen.pixelDepth+'<br>'; }); </script> </body> </html>
Output
On clicking the ‘CLICK HERE’ button −
- Related Articles
- How to center a popup window on screen using JavaScript?
- Get the size of the screen, current web page and browser window in JavaScript
- What is the role of Browser Object Model (BOM) in JavaScript?
- How to center a window on the screen in Tkinter?
- Deleting BOM component in SAP
- How to return a number of bits used to display one color on a window screen in JavaScript?
- Min window substring in JavaScript
- How to open a browser window in full screen using Selenium WebDriver with C#?
- What are Screen objects in javascript?
- Setting full screen iframe in JavaScript?
- Implement Green Screen Algorithm using JavaScript
- Unicode Byte Order Mark (BOM) character in HTML5 document.
- Window innerWidth and innerHeight Properties in JavaScript.
- Finding median for every window in JavaScript
- Target a Window Using JavaScript or HTML

Advertisements