Solved

javascript color depth

Posted on 1998-11-12
4
569 Views
Last Modified: 2008-03-03
How can i find the color depth of a visitors PC using Javascript
0
Comment
Question by:spikes
  • 2
4 Comments
 
LVL 2

Expert Comment

by:Grdv
ID: 1273943
just use:
screen.colorDepth
//Grdv
0
 
LVL 2

Accepted Solution

by:
Grdv earned 100 total points
ID: 1273944
was meant as an answer
0
 
LVL 10

Expert Comment

by:kollegov
ID: 1273945
Note that screen object inplemented first in NN4 version.
So you should check for earlier versions of browsers, before you
could use it.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1273946
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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question