[thelist] Screen Resloution Detection.

Navin Dhanuka navindhanuka at yahoo.com
Sun May 20 14:45:24 CDT 2001


Hello Everyone.

Theres no standard color resolution on every PC & thats bit problem for
designers.
I made Vapson.com in 800x600 resolution, but my client was using 1024x768,
while most of his target customers use 600x400.
We finally decided to make the site for all the versions. (We are working on
the new layout.)
Is there any other way to cope up with the resolution difference problem.

The screen resolution detection script I found at HITBOX.com & modified it a
bit, Are there any suggestions:


<SCRIPT LANGUAGE="JAVASCRIPT">
document.write("This browser version is " + navigator.appVersion)
document.write(" of <B>" + navigator.appName + "</B>. ")

// browser test:
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

if (browserName == "Netscape" && browserVer >= 4 || browserName ==
"Microsoft Internet Explorer" && browserVer >= 4)
version = "1";
else
if (browserName == "Netscape" && browserVer >= 3)
version = "2";
else
version = "3";

if (version == "1")
{
	var correctwidth=800
	var correctheight=600

	if (screen.width<correctwidth||screen.height<correctheight)
	location="resolution600.htm"
	else
	if (screen.width>correctwidth||screen.height>correctheight)
	location="resolution_more.htm"
	else
	location="resolution800.htm"
}

if (version == "2")
{
	var toolkit = java.awt.Toolkit.getDefaultToolkit();
	var screen_size = toolkit.getScreenSize();
	var correctwidth=800
	var correctheight=600

	if (screen_size.width<correctwidth||screen_size.height<correctheight)
	location="resolution600.htm"
	else
	if (screen_size.width>correctwidth||screen_size.height>correctheight)
	location="resolution_more.htm"
	else
	location="resolution800.htm"
}


if (version == "3")
location="resolution800.htm"
</SCRIPT>

//Navin Dhanuka
//NetInfoTech.net
//We make the net'work' for you.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





More information about the thelist mailing list