<script type="text/javaxcript">
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)
Sys.ie = ua.match(/msie ([\d.]+)/)[1]
else if (document.getBoxObjectFor)
Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
else if (window.MessageEvent && !document.getBoxObjectFor)
Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
else if (window.opera)
Sys.opera = ua.match(/opera.([\d.]+)/)[1]
else if (window.openDatabase)
Sys.safari = ua.match(/version\/([\d.]+)/)[1];
if (Sys.ie) alert('IE: ' + Sys.ie);
if (Sys.firefox) alert('Firefox: ' + Sys.firefox);
if (Sys.chrome) alert('Chrome: ' + Sys.chrome);
if (Sys.opera) alert('Opera: ' + Sys.opera);
if (Sys.safari) alert('Safari: ' + Sys.safari);
或者根据你知道的浏览器的类型进行判断
if(ua.indexof("iphone")!=-1)
{
alert("iphone浏览器");
}
if(ua.indexof("chrome")!=-1)
{
alert("chrome浏览器");
}
.......
</script>