Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Intermediate
Nov 18, 1998

Detecting User's Screen Resolution and Color Depth

At times you might want to know how much screen real estate a user has before opening several new browser windows. You also might want to find out if they have a high-color display capable of showing a detailed color image. The following code shows how to learn the user's screen real estate and color depth. The total screen size includes unusable areas like the icon tray on Windows or the menubar on the Mac. The available screen size attributes subtract these system-reserved areas from the total screen size. For multi-screen systems, Internet Explorer will return the size of the monitor it is on, while Netscape returns the size of both monitors combined.
 
<HTML>
<HEAD>
	<TITLE>Detecting the user's hardware</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" ALINK="#6600FF" VLINK="#CC0000">
<SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
	<!--
	document.writeln("Total Screen size = ", screen.width, " x ", screen.height);
	document.writeln("<P>");
	document.writeln("Available Screen size = ", screen.availWidth, " x ", screen.availHeight);
	document.writeln("<P>");
	document.writeln("Color depth = ", screen.colorDepth);
	//-->
</SCRIPT>
</BODY>
</HTML>
Erik Goetze
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date