How does JavaScript determine the browser and its version information
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!