JavaScript判断浏览器类型
1 <script type=”text/javascript”>
2 <!–
3 var Browser = {
4 ’isIE’ : (navigator.userAgent.indexOf(‘MSIE’) >= 0) && (navigator.userAgent.indexOf(‘Opera’) < 0),
5 ’isFirefox’ : navigator.userAgent.indexOf(‘Firefox’) >= 0,
6 ’isOpera’ : navigator.userAgent.indexOf(‘Opera’) >= 0
7 };
8 //alert(navigator.userAgent);
9 alert(Browser["isIE"]);//isIE
10 alert(Browser["isFirefox"]);//isFirefox
11 alert(Browser["isOpera"]);//isOpera
12 –>
13 </script>