Solved

javascript color depth

Posted on 1998-11-12
4
560 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now