Find Browser type & version?

后端 未结 3 1646
北海茫月
北海茫月 2020-12-05 21:30

Anyone knows of a good and reliable way to find out type & version of a browser installed on client either using JavaScript/jQuery?

Looks like jQuery has some b

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-05 22:01

    Approach 1:
    Note: Since JQuery 1.3, jQuery.browser is deprecated

    Try this :

    
    
    
    
    
    
    
    
    

    Browser info: (key : value)


    Approach 2:

    
    // A quick solution without using regexp (to speed up a little).
    var userAgent = navigator.userAgent.toString().toLowerCase();
    if ((userAgent.indexOf('safari') != -1) && !(userAgent.indexOf('chrome') != -1)) {
    alert('We should be on Safari only!');
    }
    
    

提交回复
热议问题