File: mobrowser.js

package info (click to toggle)
phpwiki 1.3.12p3-5etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 16,956 kB
  • ctags: 21,608
  • sloc: php: 82,335; xml: 3,840; sh: 1,522; sql: 1,198; perl: 625; makefile: 562; awk: 28
file content (33 lines) | stat: -rw-r--r-- 1,414 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
*	mo's browser checker
*	heavily based on the v1 library
*	mo / mircho@hotmail.com
*	please keep this note here
*/

//make a browser checker object
function cBrowser() {
	var userAgent = navigator.userAgent.toLowerCase()
	this.version = parseInt(navigator.appVersion)
	this.subVersion = parseFloat(navigator.appVersion)
	this.ns  = ((userAgent.indexOf('mozilla')!=-1) && ((userAgent.indexOf('spoofer')==-1) && (userAgent.indexOf('compatible') == -1)))
	this.ns2 = (this.ns && (this.version == 2))
	this.ns3 = (this.ns && (this.version == 3))
	this.ns4b = (this.ns && (this.subVersion < 4.04))
	this.ns4 = (this.ns && (this.version == 4))
	this.ns5 = (this.ns && (this.version == 5))
	this.ie   = (userAgent.indexOf('msie') != -1)
	this.ie3  = (this.ie && (this.version == 2))
	this.ie4  = (this.ie && (this.version == 4) && (userAgent.indexOf('msie 4.')!=-1))
	this.ie5  = (this.ie && (this.version == 4) && (userAgent.indexOf('msie 5.0')!=-1))
	this.ie55 = (this.ie && (this.version == 4) && (userAgent.indexOf('msie 5.5')!=-1))
	this.ie6 = (this.ie && (this.version == 4) && (userAgent.indexOf('msie 6.0')!=-1))
	this.op3 = (userAgent.indexOf('opera') != -1)
	this.win   = (userAgent.indexOf('win')!=-1)
	this.mac   = (userAgent.indexOf('mac')!=-1)
	this.unix  = (userAgent.indexOf('x11')!=-1)
	this.name = navigator.appName
	this.dom = this.ns5 || this.ie5 || this.ie55 || this.ie6
}

var bw = new cBrowser()