- 最后登录
- 2018-6-29
- 注册时间
- 2011-7-1
- 阅读权限
- 20
- 积分
- 359
- 纳金币
- 335582
- 精华
- 0
|
var
sUserAgent
=
navigator.userAgent;
var
fAppVersion
=
parseFloat(navigator.appVersion);
function
compareVersions(sVersion1, sVersion2) {
var
arrVersion1
=
sVersion1.split(
"
.
"
);
var
arrVersion2
=
sVersion2.split(
"
.
"
);
if
(arrVersion1.length
>
arrVersion2.length) {
for
(
var
i
=
0
; i
<
arrVersion1.length
-
arrVersion2.length; i
++
) {
arrVersion2.push(
"
0
"
);
}
}
else
if
(arrVersion1.length
<
arrVersion2.length) {
for
(
var
i
=
0
; i
<
arrVersion2.length
-
arrVersion1.length; i
++
) {
arrVersion1.push(
"
0
"
);
}
}
for
(
var
i
=
0
; i
<
arrVersion1.length; i
++
) {
if
(arrVersion1
<
arrVersion2) {
return
-
1
;
}
else
if
(arrVersion1
>
arrVersion2) {
return
1
;
}
}
return
0
;
}
var
isOpera
=
sUserAgent.indexOf(
"
Opera
"
)
>
-
1
;
var
isMinOpera4
=
isMinOpera5
=
isMinOpera6
=
isMinOpera7
=
isMinOpera7
_
5
=
false
;
if
(isOpera) {
var
fOperaVersion;
if
(navigator.appName
==
"
Opera
"
) {
fOperaVersion
=
fAppVersion;
}
else
{
var
reOperaVersion
=
new
RegExp(
"
Opera (d+.d+)
"
);
reOperaVersion.test(sUserAgent);
fOperaVersion
=
parseFloat(RegExp[
"
$1
"
]);
}
isMinOpera4
=
fOperaVersion
>=
4
;
isMinOpera5
=
fOperaVersion
>=
5
;
isMinOpera6
=
fOperaVersion
>=
6
;
isMinOpera7
=
fOperaVersion
>=
7
;
isMinOpera7
_
5
=
fOperaVersion
>=
7.5
;
}
var
isKHTML
=
sUserAgent.indexOf(
"
KHTML
"
)
>
-
1
||
sUserAgent.indexOf(
"
Konqueror
"
)
>
-
1
||
sUserAgent.indexOf(
"
AppleWebKit
"
)
>
-
1
;
var
isMinSafari1
=
isMinSafari1
_
2
=
false
;
var
isMinKonq2
_
2
=
isMinKonq3
=
isMinKonq3
_
1
=
isMinKonq3
_
2
=
false
;
if
(isKHTML) {
isSafari
=
sUserAgent.indexOf(
"
AppleWebKit
"
)
>
-
1
;
isKonq
=
sUserAgent.indexOf(
"
Konqueror
"
)
>
-
1
;
if
(isSafari) {
var
reAppleWebKit
=
new
RegExp(
"
AppleWebKit/(d+(?:.d*)?)
"
);
reAppleWebKit.test(sUserAgent);
var
fAppleWebKitVersion
=
parseFloat(RegExp[
"
$1
"
]);
isMinSafari1
=
fAppleWebKitVersion
>=
85
;
isMinSafari1
_
2
=
fAppleWebKitVersion
>=
124
;
}
else
if
(isKonq) {
var
reKonq
=
new
RegExp(
"
Konqueror/(d+(?:.d+(?:.d)?)?)
"
);
reKonq.test(sUserAgent);
isMinKonq2
_
2
=
compareVersions(RegExp[
"
$1
"
],
"
2.2
"
)
>=
0
;
isMinKonq3
=
compareVersions(RegExp[
"
$1
"
],
"
3.0
"
)
>=
0
;
isMinKonq3
_
1
=
compareVersions(RegExp[
"
$1
"
],
"
3.1
"
)
>=
0
;
isMinKonq3
_
2
=
compareVersions(RegExp[
"
$1
"
],
"
3.2
"
)
>=
0
;
}
}
var
isIE
=
sUserAgent.indexOf(
"
compatible
"
)
>
-
1
&&
sUserAgent.indexOf(
"
MSIE
"
)
>
-
1
&&
!
isOpera;
var
isMinIE4
=
isMinIE5
=
isMinIE5
_
5
=
isMinIE6
=
false
;
if
(isIE) {
var
reIE
=
new
RegExp(
"
MSIE (d+.d+);
"
);
reIE.test(sUserAgent);
var
fIEVersion
=
parseFloat(RegExp[
"
$1
"
]);
isMinIE4
=
fIEVersion
>=
4
;
isMinIE5
=
fIEVersion
>=
5
;
isMinIE5
_
5
=
fIEVersion
>=
5.5
;
isMinIE6
=
fIEVersion
>=
6.0
;
}
var
isMoz
=
sUserAgent.indexOf(
"
Gecko
"
)
>
-
1
&&
!
isKHTML;
var
isMinMoz1
=
sMinMoz1
_
4
=
isMinMoz1
_
5
=
false
;
if
(isMoz) {
var
reMoz
=
new
RegExp(
"
rvd+.d+(?:.d+)?)
"
);
reMoz.test(sUserAgent);
isMinMoz1
=
compareVersions(RegExp[
"
$1
"
],
"
1.0
"
)
>=
0
;
isMinMoz1
_
4
=
compareVersions(RegExp[
"
$1
"
],
"
1.4
"
)
>=
0
;
isMinMoz1
_
5
=
compareVersions(RegExp[
"
$1
"
],
"
1.5
"
)
>=
0
;
}
var
isNS4
=
!
isIE
&&
!
isOpera
&&
!
isMoz
&&
!
isKHTML
&&
(sUserAgent.indexOf(
"
Mozilla
"
)
==
0
)
&&
(navigator.appName
==
"
Netscape
"
)
&&
(fAppVersion
>=
4.0
&&
fAppVersion
<
5.0
);
var
isMinNS4
=
isMinNS4
_
5
=
isMinNS4
_
7
=
isMinNS4
_
8
=
false
;
if
(isNS4) {
isMinNS4
=
true
;
isMinNS4
_
5
=
fAppVersion
>=
4.5
;
isMinNS4
_
7
=
fAppVersion
>=
4.7
;
isMinNS4
_
8
=
fAppVersion
>=
4.8
;
}
var
isWin
=
(navigator.platform
==
"
Win32
"
)
||
(navigator.platform
==
"
Windows
"
);
var
isMac
=
(navigator.platform
==
"
Mac68K
"
)
||
(navigator.platform
==
"
MacPPC
"
)
||
(navigator.platform
==
"
Macintosh
"
);
var
isUnix
=
(navigator.platform
==
"
X11
"
)
&&
!
isWin
&&
!
isMac;
var
isWin95
=
isWin98
=
isWinNT4
=
isWin2K
=
isWinME
=
isWinXP
=
false
;
var
isMac68K
=
isMacPPC
=
false
;
var
isSunOS
=
isMinSunOS4
=
isMinSunOS5
=
isMinSunOS5
_
5
=
false
;
if
(isWin) {
isWin95
=
sUserAgent.indexOf(
"
Win95
"
)
>
-
1
||
sUserAgent.indexOf(
"
Windows 95
"
)
>
-
1
;
isWin98
=
sUserAgent.indexOf(
"
Win98
"
)
>
-
1
||
sUserAgent.indexOf(
"
Windows 98
"
)
>
-
1
;
isWinME
=
sUserAgent.indexOf(
"
Win 9x 4.90
"
)
>
-
1
||
sUserAgent.indexOf(
"
Windows ME
"
)
>
-
1
;
isWin2K
=
sUserAgent.indexOf(
"
Windows NT 5.0
"
)
>
-
1
||
sUserAgent.indexOf(
"
Windows 2000
"
)
>
-
1
;
isWinXP
=
sUserAgent.indexOf(
"
Windows NT 5.1
"
)
>
-
1
||
sUserAgent.indexOf(
"
Windows XP
"
)
>
-
1
;
isWinNT4
=
sUserAgent.indexOf(
"
WinNT
"
)
>
-
1
||
sUserAgent.indexOf(
"
Windows NT
"
)
>
-
1
||
sUserAgent.indexOf(
"
WinNT4.0
"
)
>
-
1
|
|