- // 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
本文介绍了一种简单的JavaScript方法来检测用户正在使用的浏览器类型,包括IE、Chrome和Firefox等主流浏览器。
1323

被折叠的 条评论
为什么被折叠?



