Solved

javascript color depth

Posted on 1998-11-12
4
579 Views
Last Modified: 2008-03-03
How can i find the color depth of a visitors PC using Javascript
0
Comment
Question by:spikes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

761 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