Web Development Course:
- The object
- Modern technology uses 32 bit (4,294,967,296 colors) and 24 bit (16,777,216 colors) color resolution.
- Old computers use 16 bit (65,536 colors) resolution. You can sometimes see computers and cell phones that use 8 bit (256 VGA colors), but that's extremely old technology.
- Pixel depth and color depth are equal for new computers.
document.write("The width of your screen: " + screen.width);
document.write("The height of your screen: " + screen.height);
document.write("Your available screen width: " + screen.availWidth);
document.write("Your available screen height: " + screen.availHeight);
To find out the width and height of the content area, you can also use
window.innerHeight. Keep in mind both of these properties are read-only.
To return the amount of bits used to display one color, you may use
screen.colorDepth. See the example below to find out this information about your own screen:
document.write("Color depth of your screen: " + screen.colorDepth);
To get the screen's pixel depth, we can use
document.write("Pixel depth of your screen: " + screen.pixelDepth);
- You can use the
- To get the width of the content area of the screen,
window.innerwidthshould be used.