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. Dojo toolkit
7. Event
8. Event onMethod
9. Ext JS
10. Form Control
11. GUI Components
12. HTML
13. Javascript Collections
14. Javascript Objects
15. Javascript Properties
16. jQuery
17. Language Basics
18. Mochkit
19. Mootools
20. Node Operation
21. Object Oriented
22. Page Components
23. Rico
24. Scriptaculous
25. Security
26. SmartClient
27. Style Layout
28. Table
29. Utilities
30. Window Browser
31. YUI Library
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 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
17. document.alinkColor
18. document.lastModified
19. document.title
20. document.bgColor
21. document.fgColor
22. document.linkColor
23. document.vlinkColor
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.