Javascript determines client browser type code _javascript tips

Source: Internet
Author: User
Copy Code code as follows:

<script type= "Text/javascript" >
/* Detailed method 1*/
function Checkbrowser ()
{
var app=navigator.appname;
var verstr=navigator.appversion;
Firefox browser
if (App.indexof (' Netscape ')!=-1)
{
Alert ("You are using a Netscape browser or a Firefox browser.") ");
}
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.index Of ("MSIE 5.1")!=-1)
{
Alert ("You are using a browser with a lower version (IE6.0 below).");
}
Else
{
Alert ("You are using a browser above IE6.0.");
}
}
}
/* Concise Method 2*/
function CheckBrowser1 ()
{
if (Window.navigator.userAgent.indexOf ("MSIE") >=1)
If the browser is IE
{
Alert ("IE browser");
}
else//If the browser is Firefox
{
if (Window.navigator.userAgent.indexOf ("Firefox") >=1)
{
Alert ("Fixfox browser");
}
}
}
Call
Checkbrowser ();
CheckBrowser1 ();
</script>

JavaScript gets Client Information
Copy Code code as follows:

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/>")
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.