Functions to Examine Browsers : Browser Info « Window Browser « JavaScript DHTML

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Event
7. Event onMethod
8. Form Control
9. GUI Components
10. HTML
11. Javascript Collections
12. Javascript Objects
13. Language Basics
14. Node Operation
15. Object Oriented
16. Page Components
17. Security
18. Style Layout
19. Table
20. Utilities
21. Window Browser
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
JavaScript DHTML » Window Browser » Browser Info 
Functions to Examine Browsers

/*
JavaScript Bible, Fourth Edition
by Danny Goodman 

Publisher: John Wiley & Sons CopyRight 2001
ISBN: 0764533428
*/


<HTML>
<HEAD>
<TITLE>UserAgent Property Library</TITLE>
<SCRIPT LANGUAGE="JavaScript">
// basic brand determination
function isNav() {
    return (navigator.appName == "Netscape")
}
function isIE() {
    return (navigator.appName == "Microsoft Internet Explorer")
}
// operating system platforms
function isWindows() {
    return (navigator.appVersion.indexOf("Win"!= -1)
}
function isWin95NT() {
    return (isWindows() && (navigator.appVersion.indexOf("Win16"== -&& 
        navigator.appVersion.indexOf("Windows 3.1"== -1))
}
function isMac() {
    return (navigator.appVersion.indexOf("Mac"!= -1)
}
function isMacPPC() {
    return (isMac() && (navigator.appVersion.indexOf("PPC"!= -|| 
       navigator.appVersion.indexOf("PowerPC"!= -1))
}
function isUnix() {
    return (navigator.appVersion.indexOf("X11"!= -1)
}
// browser versions
function isGeneration2() {
    return (parseInt(navigator.appVersion== 2)
}
function isGeneration3() {
    return (parseInt(navigator.appVersion== 3)
}
function isGeneration3Min() {
    return (parseInt(navigator.appVersion.charAt(0)) >= 3)
}
function isNav4_7() {
    return (isNav() && parseFloat(navigator.appVersion== 4.7)
}
function isMSIE4Min() {
    return (isIE() && navigator.appVersion.indexOf("MSIE"!= -1)
}
function isMSIE5_5() {
    return (navigator.appVersion.indexOf("MSIE 5.5"!= -1)
}
function isNN6Min() {
    return (isNav() && parseInt(navigator.appVersion>= 5)
}
// element referencing syntax
function isDocAll() {
    return (document.alltrue false
}
function isDocW3C() {
    return (document.getElementByIdtrue false
}
// fill in the blanks
function checkBrowser() {
    var form = document.forms[0]
    form.brandNN.value = isNav()
    form.brandIE.value = isIE()
    form.win.value = isWindows()
    form.win32.value = isWin95NT()
    form.mac.value = isMac()
    form.ppc.value = isMacPPC()
    form.unix.value = isUnix()
    form.ver3Only.value = isGeneration3()
    form.ver3Up.value = isGeneration3Min()
    form.Nav4_7.value = isNav4_7()
    form.Nav6Up.value = isNN6Min()
    form.MSIE4.value = isMSIE4Min()
    form.MSIE5_5.value = isMSIE5_5()
    form.doc_all.value = isDocAll()

form.doc_w3c.value = isDocW3C()
}
</SCRIPT>
</HEAD>
<BODY onLoad="checkBrowser()">
<H1>About This Browser</H1>
<FORM>
<H2>Brand</H2>
Netscape Navigator:<INPUT TYPE="text" NAME="brandNN" SIZE=5>
Internet Explorer:<INPUT TYPE="text" NAME="brandIE" SIZE=5>
<HR>
<H2>Browser Version</H2>
3.0x Only (any brand):<INPUT TYPE="text" NAME="ver3Only" SIZE=5><P>
or Later (any brand): <INPUT TYPE="text" NAME="ver3Up" SIZE=5><P>
Navigator 4.7: <INPUT TYPE="text" NAME="Nav4_7" SIZE=5><P>
Navigator 6+: <INPUT TYPE="text" NAME="Nav6Up" SIZE=5><P>
MSIE 4+: <INPUT TYPE="text" NAME="MSIE4" SIZE=5><P>
MSIE 5.5:<INPUT TYPE="text" NAME="MSIE5_5" SIZE=5><P>
<HR>
<H2>OS Platform</H2>
Windows: <INPUT TYPE="text" NAME="win" SIZE=5>
Windows 95/98/2000/NT: <INPUT TYPE="text" NAME="win32" SIZE=5><P>
Macintosh: <INPUT TYPE="text" NAME="mac" SIZE=5>
Mac PowerPC: <INPUT TYPE="text" NAME="ppc" SIZE=5><P>
Unix: <INPUT TYPE="text" NAME="unix" SIZE=5><P>
<HR>
<H2>Element Referencing Style</H2>
Use <TT>document.all</TT>: <INPUT TYPE="text" NAME="doc_all" SIZE=5><P>
Use <TT>document.getElementById()</TT>: <INPUT TYPE="text" NAME="doc_w3c"
 SIZE=5><P>
</FORM>
</BODY>
</HTML>


           
       
Related examples in the same category
1. Detects the browser, its version and the operating system of the client
2. Detects the language used by the client's browser
3. Indentify your browser
4. Navigator:detect the client's browser
5. More details about the client's browser
6. All details about the client's browser
7. Browser infomation
8. Accessing the Properties of the navigator Object
9. Writing Different Text to a Page Based on the Browser
10.  Navigator Object
11. Using Navigator Properties
12. Get Browser version
13. Methods and Properties of the Frame Object
14. The Methods and Properties of the navigator Object
15. Verify browser language
16. Is cookie Enabled
www__.___j_ava___2___s__.___c__o__m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.