Link to home
Start Free TrialLog in
Avatar of spikes
spikes

asked on

javascript color depth

How can i find the color depth of a visitors PC using Javascript
Avatar of Grdv
Grdv

just use:
screen.colorDepth
//Grdv
ASKER CERTIFIED SOLUTION
Avatar of Grdv
Grdv

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note that screen object inplemented first in NN4 version.
So you should check for earlier versions of browsers, before you
could use it.
Avatar of Michel Plungjan
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