litesoft
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
34
35
36
37
38
39
40
41
|
package com.temp.client.foundation.support.useragent.nonpublic;
import com.temp.client.foundation.support.useragent.BrowserFamily;
import com.temp.client.foundation.support.useragent.UserAgent;
/**
* Represents IE - supporting code the UserAgent
*
* @author georgs
*/
public class UserAgentIE extends UserAgent {
private boolean mLegacyIE;
public UserAgentIE() {
super(BrowserFamily.IE, "");
int zVersion = determineSpecificVersion();
mLegacyIE = (zVersion < 9);
mSpecific = IE_PREFIX + zVersion;
}
@Override
public boolean isLegacyIE() {
return mLegacyIE;
}
// ; MSIE 6.0;
// 01234567890
private static int determineSpecificVersion() {
String zUserAgent = getBrowserUserAgent();
int atStart = zUserAgent.indexOf("; MSIE ") + 7;
int atEnd = zUserAgent.indexOf(".0;", atStart);
if ((atStart > 6) && (atEnd != -1) && (atEnd <= (atStart + 2))) { // Note: this will only work up to version 99!
try {
return Integer.parseInt(zUserAgent.substring(atStart, atEnd));
} catch (NumberFormatException e) {
// Really? Then Assume the default
}
}
return 8;
}
}
|
Revision |
Author |
Commited |
Message |
626
|
GeorgeS
|
Wed 11 Apr, 2012 19:39:41 +0000 |
|