javascript: get Operating System version

javascript:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<script type="text/javascript">
console.log(navigator.userAgent)
console.log(navigator.appVersion)
console.log(navigator.platform)
//Win10 Edge geovindu,涂聚文,Geovin Du
//Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
//5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
//Win32
navigator.userAgentData.getHighEntropyValues(['platformVersion'])
.then(uapv => { console.log(uapv.platformVersion); }); 
//10.0.0  
      
      
//firefox
/*
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0 NyHSMNy:7:9
5.0 (Windows) NyHSMNy:8:9
Win32
*/
/*
google Chrome
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
lcK2XKo:8 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
lcK2XKo:9 Win32
lcK2XKo:15 10.0.0
*/
     
     
     
/*
win11 edge:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
Win32
14.0.0
 
firefox:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
5.0 (Windows)
Win32
 
 
google chrome:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
 Win32
 14.0.0
*/ 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>检测</title>
<meta name="author" content="geovindu"/>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
 $(document).ready(function() {
var du= document.getElementById("geovindu");
var du1=document.getElementById("geovindu1");
var du2=document.getElementById("geovindu2");
var du3=document.getElementById("geovindu3");
let ua=navigator.userAgent;
//document.write(ua);
//$("#geovindu").text("userAgent:"+ua);
//document.getElementById("geovindu").innerHTML="ua:"+ua;
      
du.innerHTML="userAgent:"+navigator.userAgent;
console.log(navigator.userAgent)
du1.innerHTML=navigator.appVersion.toString();
console.log(navigator.appVersion)
du2.innerHTML=navigator.platform.toString();
console.log(navigator.platform)
//Win10 Edge geovindu,涂聚文,Geovin Du
//Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
//5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
//Win32
navigator.userAgentData.getHighEntropyValues(['platformVersion'])
.then(uapv => {
    du3.innerHTML=uapv.platformVersion.toString();
    console.log(uapv.platformVersion);
});
//10.0.0 
       
});
//firefox
/*
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0 NyHSMNy:7:9
5.0 (Windows) NyHSMNy:8:9
Win32
*/
/*
google Chrome
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
lcK2XKo:8 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
lcK2XKo:9 Win32
lcK2XKo:15 10.0.0
 
opera:
 
userAgent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.84
5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.84
Win32
10.0.0
*/
      
      
      
/*
win11 edge:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
Win32
14.0.0
  
firefox:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
5.0 (Windows)
Win32
  
  
google chrome:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
 Win32
 14.0.0
*/
      
</script>   
</head>
  
<body>
    <div id="geovindu"></div>
    <div id="geovindu1"></div>
    <div id="geovindu2"></div>
    <div id="geovindu3"></div>
</body>
</html>

  


 

java: 

1
2
3
4
            System.out.println("OS Name: " + System.getProperty("os.name"));
            System.out.println("OS Version: " + System.getProperty("os.version"));
//OS Name: Windows 10
//OS Version: 10.0

  

C#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Response.Write(Environment.OSVersion.Version.Build.ToString());
 
 
 
 
   }
   /// <summary>
   /// 是否WIN11
   /// </summary>
   /// <returns></returns>
   public static bool IsWindows11()
   {
       var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
 
       var currentBuildStr = (string)reg.GetValue("CurrentBuild");
       var currentBuild = int.Parse(currentBuildStr);
 
       if(Environment.OSVersion.Version.Build>=2200)
       {
           int ver = 11;
       }
 
       using (var objOS = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"))
       {
           foreach (ManagementObject objMgmt in objOS.Get())
           {
               Console.WriteLine("{0}: {1}", objMgmt.Properties["Caption"].Name, objMgmt.Properties["Caption"].Value);
           }
       }
 
 
       return currentBuild >= 22000;
   }

  

Windows Version Sec-CH-UA-Platform-Version
Windows 7 | 8 | 8.1 0.0.0
Windows 10 1507 1.0.0
Windows 10 1511 2.0.0
Windows 10 1607 3.0.0
Windows 10 1703 4.0.0
Windows 10 1709 5.0.0
Windows 10 1803 6.0.0
Windows 10 1809 7.0.0
Windows 10 1903 | 1909 8.0.0
Windows 10 2004 | 20H2 | 21H1 10.0.0
Windows 11 Previews 13.0.0 | 14.0.0
Windows 11 Release 15.0.0

 

https://bestiejs.github.io/platform.js/
https://www.npmjs.com/package/platform
https://github.com/bestiejs/platform.js
https://textslashplain.com/2021/09/21/determining-os-platform-version/
https://angularfixing.com/how-to-get-os-version-name-on-mobile-tablet-or-pc-in-angular-project/
https://github.com/becher/angular-device-information
https://www.codeproject.com/Articles/5336372/Windows-11-Version-Detection
https://www.anoopcnair.com/windows-10-build-numbers-version-numbers/
https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information

 Supported versions of Windows client | Microsoft Learn

https://learn.microsoft.com/en-us/windows/release-health/supported-versions-windows-client

https://learn.microsoft.com/en-us/windows/release-health/release-information
Windows 11 build number starts with 20000
Windows 10 build numbers starting with 10000
Windows 8.1 build numbers starting with 9000
Windows XP build numbers starting with 3000

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Response.Write(Environment.OSVersion.Version.Build.ToString());
 
Response.Write("Operating System Detaiils");
 
OperatingSystem os = Environment.OSVersion;
 
Response.Write("OS Version: " + os.Version.ToString());
 
Response.Write("OS Platoform: " + os.Platform.ToString());
 
Response.Write("OS SP: " + os.ServicePack.ToString());
 
Response.Write("OS Version String: " + os.VersionString.ToString());
 
Response.Write("<br/>");
 
 
 
// Get Version details
 
Version ver = os.Version;
 
Response.Write("Major version: " + ver.Major);
 
Response.Write("Major Revision: " + ver.MajorRevision);
 
Response.Write("Minor version: " + ver.Minor);
 
Response.Write("Minor Revision: " + ver.MinorRevision);
 
Response.Write("Build: " + ver.Build);

  

 

posted @   ®Geovin Du Dream Park™  阅读(103)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示