function BrowserDetection() {
//Check if browser is IE or not
if (navigator.userAgent.search("MSIE") >= 0) {
return "InternetExplorer";
}
//Check if browser is Chrome or not
else if (navigator.userAgent.search("Chrome") >= 0) {
return "chrome";
}
//Check if browser is Firefox or not
else if (navigator.userAgent.search("Firefox") >= 0) {
return "fireFox";
}
//Check if browser is Safari or not
else if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) {
return "safari";
}
//Check if browser is Opera or not
else if (navigator.userAgent.search("Opera") >= 0) {
return "opera";
}
}
var browsername=BrowserDetection();
alert(browsername);
0 comments: