Return to Main Menudzigns by ShivSpacer
 

Explanation

(This Script is Netscape6 Compliant)
Updated - December, 2000.


You'll be absolutely correct if you are saying to yourself there are 100s of Sites which offer Free Cut-n-Paste "Visitor's Screen Resolution" finder JavaScript. But, as far as my limited knowledge goes, I'm not certain if anyone has thought of -

  1. Embedding this little script within CSS, such that it looks better like the one you see above.
  2. Since some of the older Browsers do not understand what's meant by "screen.width" and "screen.height" such Scripts MAY give you JavaScript Error Alert, say, when & if your visitor is using Netscape3. This one will only work on 4th Generation or Higher Browsers. Older Browsers will simply see NOTHING!
By the way, I have put this script within a Table - only so that it looks neat. You need not do so. Instead you can specify where exactly should this appear on visitors Screen by defining an absolute position.

The Script & Style

Paste this section within the HEAD tags. Define/alter the Style as you wish.

<script language="javascript">
<!-- hide from old browsers
// Written & created by Shivaji Basu
// Copyright www.shivbasu.com
// Use this script at your own risk
// To use his script, you MUST leave this disclaimer & credit as it is

// the following lines are to sniff out older browsers

// It has now become necessary to sniff out ns4 separately from ns6.
// For ease of understanding, I've sniffed out ie4 & ie5 separately
// Although these could have stayed together
// Or ie5 could have been clubbed with ns6

ns4 = (document.layers)? true:false
ie5=(document.getElementById)? true:false
ns6=(document.getElementById)? true:false
ie4=(document.all && !(document.getElementById))? true:false

//--end hide>
</script>

<STYLE type=text/css>
<!--
#reso{color:#ff0000; font-size:12px; padding:2;layer-background-color:#e1e1ff;
background-color:#e1e1ff; border-color:#000080; border-width:5; border-style:inset;
}

#figures{color:#800080;font-weight:bold; font-size:14px;
}

-->
</STYLE>

Paste this part in the BODY Section

<center><table border=0><tr><td>
<script language="javascript">
if(ns4||ie4||ie5||ns6){
document.write('<div id="reso">YOUR SCREEN RESOLUTION IS: ');
document.write('<span id="figures">');
document.write(screen.width + " x " + screen.height);
document.write('</span> & <span id="figures">');
document.write(screen.colorDepth);
document.write('</span> BIT COLOR</div>')
}

//-->
</SCRIPT>
</td></tr></table></center>



Copyright DBS © 1998-2003. All Rights Reserved