简体   繁体   中英

jQuery/Javascript browser detection

I'm sorry if this question has been asked already. How would I find a user's browser and version using JavaScript or jQuery? I know that .browser() is deprecated as of jQuery 1.9. I am not doing this for code specific purposes, I'm trying to find the browser type for statistical purposes.

Yes is it depecated already in jquery 1.9.

I guess the best code for determining the browser is to usethe traditional

navigator.userAgent

http://www.w3schools.com/jsref/prop_nav_useragent.asp

There is a JS Plugin thst you can use:

<p>
  Click to <a id="detect_browser"
              href="javascript:void(0);">Detect browser properties</a>
</p>


 $("#detect_browser").click(function() {
      alert(JSON.stringify(bowser, null, '    '));
    });

http://www.pontikis.net/tip/?id=27

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM