CancelImage Upload

How to find out a screen's bit depth color pallete using JavaScript

To find out what the bit depth of a visitors screen is using JavaScript you will need to use the following code:

var depth = screen.colorDepth;

Here is a more complete example of this information being loaded into a span via getElementById():

<html>
<head>
<title>Load Screen Color Depth</title>

<script language="JavaScript">

function loadDepth()
{

        var colorDepth = document.getElementById("colorDepth");

        var depth = screen.colorDepth;

        colorDepth.innerHTML = "Bit depth: " + depth;

}

</script>

</head>
<body onload="javascript:loadDepth();">

<span id="colorDepth"></span>

</body>
</html>


Login
Want to leave a comment?

No problem. Just enter your email and password below.


register | home | reminder

myDesignTool Networking • www.mydesigntool.cominfo@mydesigntool.com