複製代碼 代碼如下:<script type="text/javascript">
/*詳細方法1*/
function CheckBrowser()
{
var app=navigator.appName;
var verStr=navigator.appVersion;
//Firefox瀏覽器
if (app.indexOf('Netscape') != -1)
{
alert("你使用的是Netscape瀏覽器或Firefox瀏覽器。");
}
else if (app.indexOf('Microsoft') != -1)
{
if (verStr.indexOf("MSIE 3.0")!=-1 || verStr.indexOf("MSIE 4.0") != -1 || verStr.indexOf("MSIE 5.0") != -1 || verStr.indexOf("MSIE 5.1") != -1)
{
alert("您使用的是低版本(IE6.0以下)的瀏覽器.");
}
else
{
alert("您使用的是IE6.0以上的瀏覽器.");
}
}
}
/*簡潔方法2*/
function CheckBrowser1()
{
if (window.navigator.userAgent.indexOf("MSIE")>=1)
//如果瀏覽器為IE
{
alert("IE瀏覽器");
}
else //如果瀏覽器為Firefox
{
if (window.navigator.userAgent.indexOf("Firefox")>=1)
{
alert("Fixfox瀏覽器");
}
}
}
//調用
CheckBrowser();
CheckBrowser1();
</script>
JavaScript 擷取 用戶端資訊 複製代碼 代碼如下:document.write("Screen resolution: ")
document.write(screen.width + "*" + screen.height)
document.write("<br />")
document.write("Available view area: ")
document.write(screen.availWidth + "*" + screen.availHeight)
document.write("<br />")
document.write("Color depth: ")
document.write(screen.colorDepth)
document.write("<br />")
document.write("Buffer depth: ")
document.write(screen.bufferDepth)
document.write("<br />")
document.write("DeviceXDPI: ")
document.write(screen.deviceXDPI)
document.write("<br />")
document.write("DeviceYDPI: ")
document.write(screen.deviceYDPI)
document.write("<br />")
document.write("LogicalXDPI: ")
document.write(screen.logicalXDPI)
document.write("<br />")
document.write("LogicalYDPI: ")
document.write(screen.logicalYDPI)
document.write("<br />")
document.write("FontSmoothingEnabled: ")
document.write(screen.fontSmoothingEnabled)
document.write("<br />")
document.write("PixelDepth: ")
document.write(screen.pixelDepth)
document.write("<br />")
document.write("UpdateInterval: ")
document.write(screen.updateInterval)
document.write("<br />")