SoFunction
Updated on 2025-04-07

Detailed explanation of JS determines which browser instance the user uses

The following is a sample code to share with you which browser the user uses. The specific code is as follows:

var Sys = {};
var ua = ();
var s;
(s = (/msie ([\d.]+)/)) ?  = s[1] :
(s = (/firefox/([\d.]+)/)) ?  = s[1] :
(s = (/chrome/([\d.]+)/)) ?  = s[1] :
(s = (/opera.([\d.]+)/)) ?  = s[1] :
(s = (/version/([\d.]+).*safari/)) ?  = s[1] : 0;
/Test below/
if () alert('IE: ' + );
if () alert('Firefox: ' + );
if () alert('Chrome: ' + );
if () alert('Opera: ' + );
if () alert('Safari: ' + );
if ( == 9.0 ||  == 8.0 ||  == 7.0 ||  == 7.0){
//This is the jump path}

Summarize

The above is the JS introduction to determine which browser the user uses. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!