javascript color depth

How can i find the color depth of a visitors PC using Javascript
spikesAsked:
Who is Participating?
 
GrdvConnect With a Mentor Commented:
was meant as an answer
0
 
GrdvCommented:
just use:
screen.colorDepth
//Grdv
0
 
kollegovCommented:
Note that screen object inplemented first in NN4 version.
So you should check for earlier versions of browsers, before you
could use it.
0
 
Michel PlungjanIT ExpertCommented:
or just
if (window.screen) ColD = screen.colorDepth;
colorDepth in N4 isn't adapted for that purpose, returning
the # of bits available for composing a palette
color mode:_256_64K_16M
pixelDepth:___8__16__24
colorDepth:__18__16__24

'scuse the formatting

so a the better test would be

if (window.screen) {
      ColD = screen.pixelDepth
               ? Math.pow( 2, screen.pixelDepth ) // in N4
               : Math.pow( 2, screen.colorDepth ) // in E4
}

Michel

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.