当前位置: 代码迷 >> Web前端 >> 展示浏览者详细信息
  详细解决方案

展示浏览者详细信息

热度:322   发布时间:2012-11-25 11:44:31.0
显示浏览者详细信息
先将下列代码复制到<head></head>之间:
<SCRIPT LANGUAGE="JavaScript">

<!-- begin
function display() {
window.onerror=null;

colors = window.screen.colorDepth;
document.form.color.value = Math.pow (2, colors);
if (window.screen.fontSmoothingEnabled == true)
document.form.fonts.value = "Yes";
else document.form.fonts.value = "No";


document.form.colordepth.value = window.screen.colorDepth;
document.form.width.value = window.screen.width;
document.form.height.value = window.screen.height;
document.form.maxwidth.value = window.screen.availWidth;
document.form.maxheight.value = window.screen.availHeight;
if (navigator.javaEnabled() < 1) document.form.java.value="No";
if (navigator.javaEnabled() == 1) document.form.java.value="Yes";

if(navigator.javaEnabled() && (navigator.appName != "Microsoft Internet Explorer")) {
vartool=java.awt.Toolkit.getDefaultToolkit();
addr=java.net.InetAddress.getLocalHost();
host=addr.getHostName();
ip=addr.getHostAddress();
document.form.hostip.value = "Your host name is '" + host + "'\nYour IP address is " + ip;
   }
}
// end -->
</script>
<!-- Begin
jsver = "1.0";
// End -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.1">
<!-- Begin
jsver = "1.1";
// End -->
</SCRIPT>
<SCRIPT Language="JavaScript1.2">
<!-- Begin
jsver = "1.2";
// End -->
</SCRIPT>
<SCRIPT Language="JavaScript1.3">
<!-- Begin
jsver = "1.3";
// End -->
</SCRIPT>
<script LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >12) ? hours -12 :hours)
if (timeValue == "0") timeValue = 12;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."
document.clock.face.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock() {
stopclock();
showtime();
}
// End -->
</script>


再将下列代码复制到<body></body>之间:
<body OnLoad="display(),startclock()">
<table BORDER=0 WIDTH="100%" BGCOLOR="#FFFFFF" >
<tr>
<td COLSPAN="2" BGCOLOR="#009900">
<center>
<h2>
Your System Info</h2></center>
</td>
</tr>
<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">Current Date and Time</font>:</td>

<td BGCOLOR="#999999"><script LANGUAGE="JavaScript">

<!-- Begin
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();

// Y2K Fix by Isaac Powell
// http://onyx.idbsu.edu/~ipowell

if ((navigator.appName == "Microsoft Internet Explorer") && (year < 2000))
year="19" + year;
if (navigator.appName == "Netscape")
year=1900 + year;
document.write(""+ lmonth + " ");
document.write(date + ", " + year);
// End -->
</script>
<form name="clock"><input type="text" name="face" size=13 value=""></form></td>
</tr><tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">Your CPU Class is:</font></td>

<td BGCOLOR="#999999"><script>
document.write(navigator.cpuClass)
</script>
</td>
</tr>

<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">Your Operating System is:</font></td>

<td BGCOLOR="#999999"><script LANGUAGE="JavaScript">
<!--
function checkOS() {
  if(navigator.userAgent.indexOf('IRIX') != -1)
    { var OpSys = "Irix"; }
  else if((navigator.userAgent.indexOf('Win') != -1) &&
  (navigator.userAgent.indexOf('98') != -1))
    { var OpSys = "Windows 98"; }
  else if((navigator.userAgent.indexOf('Win') != -1) &&
  (navigator.userAgent.indexOf('95') != -1))
    { var OpSys = "Windows 95"; }
  else if(navigator.appVersion.indexOf("16") !=-1)
    { var OpSys = "Windows 3.1"; }
  else if (navigator.appVersion.indexOf("NT") !=-1)
    { var OpSys= "Windows NT"; } 
else if(navigator.appVersion.indexOf("SunOS") !=-1)
    { var OpSys = "SunOS"; }
  else if(navigator.appVersion.indexOf("Linux") !=-1)
    { var OpSys = "Linux"; } 
  else if(navigator.userAgent.indexOf('Mac') != -1)
    { var OpSys = "Macintosh"; }
  else if(navigator.appName=="WebTV Internet Terminal")
    { var OpSys="WebTV"; }
  else if(navigator.appVersion.indexOf("HP") !=-1)
    { var OpSys="HP-UX"; }
else { var OpSys = "other"; }
  return OpSys;
}
// -->
</script>
<script LANGUAGE="JavaScript">
<!--
var OpSys = checkOS();
document.write(OpSys);
// -->
</script>
</td>
</tr>

<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">You are currently using:</font></td>

<td BGCOLOR="#999999"><script Language="JavaScript">

        <!-- This is a combination of two scripts one written by Murat Muradoglu, wizkid10@hotmail.com.  I Jeff Bouton, yank2451@aol.com modified the script so that it will detect the AOL Browser as well as the new versions of Internet Explorer 5 and Netscape 4.61
        var version = 0;
               
if(navigator.userAgent.indexOf("AOL 5") != -1)  document.write("America Online 5.0");
else if
(navigator.userAgent.indexOf("AOL 4") != -1)  document.write("America Online 4.0");
else if
(navigator.userAgent.indexOf("AOL 3") != -1)  document.write("America Online 3.0");
else if
(navigator.userAgent.indexOf("MSIE 5") != -1) document.write("Internet Explorer 5.0");   
else if
(navigator.userAgent.indexOf("MSIE 4") != -1)  document.write("Internet Explorer 4.0");
else if
(navigator.userAgent.indexOf("MSIE 3") != -1)  document.write("Internet Explorer 3.0!");
else if
(navigator.userAgent.indexOf("Mozilla/5.0") != -1)  document.write("Netscape 5 Beta");
else if
(navigator.userAgent.indexOf("Mozilla/4.7") != -1)  document.write("Netscape 4.7");
else if
(navigator.userAgent.indexOf("Mozilla/4.61") != -1)  document.write("Netscape 4.61");
else if
(navigator.userAgent.indexOf("Mozilla/4.5") != -1)  document.write("Netscape 4.5");
else if
(navigator.userAgent.indexOf("Mozilla/4") != -1)  document.write("Netscape 4.0");
else if
(navigator.userAgent.indexOf("Mozilla/3") != -1)  document.write("Netscape 3.0");
else if
(navigator.userAgent.indexOf("Mozilla/2") != -1)  document.write("Netscape 2");
else if
(navigator.userAgent.indexOf("MSIE 4.5") != -1)  document.write("Microsoft Internet Explorer 4.5 for Macintosh");
else if
(navigator.appName=="WebTV Internet Terminal") document.write("WebTV Browser");
else if
(navigator.appName != "Microsoft Internet Explorer" && navigator.appName != "Netscape") document.write("You are not running IE, Netscape, AOL, or WebTV");               
else version = 8;
        // -->
</script>
</td>
</tr>
<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">The Application code of your
browser is:</font></td>
<td BGCOLOR="#999999"><script>
document.write(navigator.appCodeName)
</script>
<script>
<!--
         var version = 0;
                 if
(navigator.userAgent.indexOf("Mozilla/5.0") != -1)  document.write("5.0");
else if
(navigator.userAgent.indexOf("Mozilla/4.7") != -1)  document.write("4.7");
                else if
(navigator.userAgent.indexOf("Mozilla/4.61") != -1)  document.write("4.61");
else if
(navigator.userAgent.indexOf("Mozilla/4.5") != -1)  document.write("4.5")
                else if
                (navigator.userAgent.indexOf("Mozilla/4") != -1)  document.write("4.0");
                else if
                (navigator.userAgent.indexOf("Mozilla/3") != -1)  document.write("3.0");
                else if
                (navigator.userAgent.indexOf("Mozilla/2") != -1)  document.write("2.0");
                else document.write("Undetermined");

        // -->
</script>
</td>
</tr>
<tr BGCOLOR="#999999">
<td BGCOLOR="#000099"><font color="#FFFFFF">The Language of Your Browser
is:</font></td>

<td><script language="javascript">document.write(navigator.browserLanguage)</script>
</td>
</tr>

<tr><td BGCOLOR="#000099"><font color="#FFFFFF">You just arrived at this page from the URL:</td>
<td BGCOLOR="#999999"><Script Language="JavaScript">
<!--
document.write("(  "+ document.referrer +" )" )
//-->
</script></td></tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">Your Javascript Version:</td>
<td BGCOLOR="#999999"><SCRIPT LANGUAGE="JavaScript">
<!-- Begin
document.write("" + jsver + "")
// End -->
</SCRIPT>
</td>
</tr>
<tr BGCOLOR="#999999">
<td BGCOLOR="#000099"><font color="#FFFFFF">Cookies:</font></td>

<td><script language="javascript">
if (navigator.appName=="Microsoft Internet Explorer") {
if (navigator.cookieEnabled==true) {
document.write("Are enabled on your system.")
}
else
{document.write("Are not enabled on your system.")
}
    }
else
document.write("Netscape won't allow detection!!")
</script>
</td>
</tr>
<form name=form>
<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">
Java Enabled:</td>
<td BGCOLOR="#999999"><input type=text size=3 maxlength=3 name=java></td>
<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">
Host/IP:</td>
<td  BGCOLOR="#999999"><input type=text size=50 maxlength=100 name=hostip></td>
</tr>
<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">Current Resolution:</td>
<td BGCOLOR="#999999"><input type=text size=4 maxlength=4 name=width>
x <input type=text size=4 maxlength=4 name=height></td>
</tr>
<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">
Max Resolution:</td>
<td BGCOLOR="#999999"><input type=text size=4 maxlength=4 name=maxwidth>
x <input type=text size=4 maxlength=4 name=maxheight></td>
</tr>
<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">
Color Depth:</td>
<td BGCOLOR="#999999"><input type=text size=2 maxlength=2 name=colordepth> bit</td>
</tr>
<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">
Number of Colors:</td>
<td BGCOLOR="#999999"><input type=text size=8 maxlength=8 name=color></td>
</tr>
<tr>
<td BGCOLOR="#000099"><font color="#FFFFFF">
Anti-aliasing fonts:</td>
<td BGCOLOR="#999999"><input type=text size=3 maxlength=3 name=fonts></td>
</form>
<tr><td>
</table>