Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How does JavaScript determine the browser and its version information

Shulou Source: shulou.com Published: 2022-05-31 11:52:41 09月23日 Update

This article introduces the knowledge of "how to judge browsers and their version information by JavaScript". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

To judge by window.navigator:

Function getBrowserInfo () {var Info = {}; var str = window.navigator.userAgent.toLowerCase (); var bReg = / (msie | firefox | chrome | opera | version). *? ([\ d.] +) /; var infoArr = str.match (bReg); Info.browser = infoArr [1] .replace (/ version/, "safari"); Info.ver = infoArr [2]; return Info;} var BomInfo = getBrowserInfo (); [xss_clean] (BomInfo.browser); [xss_clean] ("); [xss_clean] (BomInfo.ver) That's all for "how JavaScript judges browsers and their version information". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Information browser version browsing content more knowledge practicality achievement next dilemma reality situation article case editing website industry process high quality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Linux OPPO Reno vpn Xiaomi