mirror of
https://github.com/Mibew/java.git
synced 2025-01-23 18:10:34 +03:00
c2206ec72b
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@106 c66351dc-e62f-0410-b875-e3a5c0b9693f
31 lines
701 B
JavaScript
31 lines
701 B
JavaScript
var myAgent = "";
|
|
var myVer = 0;
|
|
var myRealAgent = "";
|
|
|
|
function detectAgent() {
|
|
var AGENTS = ["opera","msie","safari","firefox","netscape","mozilla"];
|
|
var agent = navigator.userAgent.toLowerCase();
|
|
for (var i = 0; i < AGENTS.length; i++) {
|
|
var agentStr = AGENTS[i];
|
|
if (agent.indexOf(agentStr) != -1) {
|
|
myAgent = agentStr;
|
|
if (!window.RegExp)
|
|
break;
|
|
|
|
var versionExpr = new RegExp(agentStr + "[ \/]?([0-9]+(\.[0-9]+)?)");
|
|
if (versionExpr.exec(agent) != null) {
|
|
myVer = parseFloat(RegExp.$1);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
myRealAgent = myAgent;
|
|
if( navigator.product == "Gecko")
|
|
myAgent = "moz";
|
|
}
|
|
detectAgent();
|
|
|
|
function getEl(name) {
|
|
return document.getElementById(name);
|
|
}
|