- // 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
判断几种浏览器类型的表达式
猜你喜欢
转载自lgscofield.iteye.com/blog/1740180
今日推荐
周排行