Most of the time, you need to use js to determine the browser version and other information. The code here is from discuz. In fact, you can also learn this. Check Discuz! When the source code is found, a piece of browser verification code is still classic:
The Code is as follows:
Var BROWSER = {};
Var USERAGENT = navigator. userAgent. toLowerCase ();
Alert (USERAGENT );
BROWSER. ie = window. ActiveXObject & USERAGENT. indexOf ('msi ')! =-1 & USERAGENT. substr (USERAGENT. indexOf ('msi') + 5, 3 );
BROWSER. firefox = document. getBoxObjectFor & USERAGENT. indexOf ('Firefox ')! =-1 & USERAGENT. substr (USERAGENT. indexOf ('Firefox ') + 8, 3 );
BROWSER. chrome = window. MessageEvent &&! Document. getBoxObjectFor & USERAGENT. indexOf ('chrome ')! =-1 & USERAGENT. substr (USERAGENT. indexOf ('chromi') + 7, 10 );
BROWSER. opera = window. opera & opera. version ();
BROWSER. safari = window. openDatabase & USERAGENT. indexOf ('safari ')! =-1 & USERAGENT. substr (USERAGENT. indexOf ('safari ') + 7, 8 );
BROWSER. other =! BROWSER. ie &&! BROWSER. firefox &&! BROWSER. chrome &&! BROWSER. opera &&! BROWSER. safari;
BROWSER. firefox = BROWSER. chrome? 1: BROWSER. firefox;