- // IE浏览器
- if (/MSIE/.test(navigator.userAgent)){
- }
- // Chrome浏览器
- else if (/Chrome/.test(navigator.userAgent)){
- }
- // Firefox浏览器
- else if ( /Firefox/.test(navigator.userAgent)){
- }
- 也有这么写的:
- // 这段函数的意思是判断浏览器为Firefox浏览器,其他浏览器也可以按不照搬
-
navigator.userAgent.indexOf('Firefox') >= 0