Get the App
SLTechnology News&Howtos  ›  Development  › 

Share JS check browser type and version

Shulou Source: shulou.com Published: 2022-06-02 17:10:47 10月03日 Update

This article focuses on "sharing JS checking browser types and versions". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "sharing JS check browser types and versions".

Var Sys = {}

Var ua = navigator.userAgent.toLowerCase ()

Var s

Var scan

(s = ua.match (/ msie ([\ d.] +) /)? Sys.ie = s [1]: (s = ua

.match (/ firefox\ / ([\ d.] +) /)? Sys.firefox = s [1]: (s = ua

.match (/ chrome\ / ([\ d.] +) /)? Sys.chrome = s [1]: (s = ua

.match (/ opera. ([\ d.] +) /)? Sys.opera = s [1]: (s = ua

.match (/ version\ / ([\ d.] +). * safari/)? Sys.safari = s [1]: 0

/ / conduct the test

If (Sys.ie) {

Scan = "ie kernel you use" + Sys.ie + "browser"

}

If (Sys.firefox) {

Scan = "you are using the firefox kernel" + Sys.firefox + "browser"

}

If (Sys.chrome) {

Scan = "you are using the chrome kernel" + Sys.chrome + "browser"

}

If (Sys.opera) {

Scan = "you are using the opera kernel" + Sys.opera + "browser"

}

If (Sys.safari) {

Scan = "you are using the safari kernel" + Sys.safari + "browser"

}

Alert (scan)

At this point, I believe you have a deeper understanding of "sharing JS check browser types and versions". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Browser browsing kernel version type check content learning practical deeper interest practical practical easy to operate method more friends website channel query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info vpn Redmi OPPO Reno Linux