Home Web Front-end JS Tutorial JavaScript gets the user client operating system version_javascript tips

JavaScript gets the user client operating system version_javascript tips

May 16, 2016 pm 06:47 PM
client operating system

I went to the user site in the afternoon and felt that this problem was really strange. Finally, I found that the computer with the problem was the operating system of WIN 2000. I felt that the crux of the problem might be here. I googled it online and found that Media Player 11 does not support the Win2000 system. It is necessary to determine the version of the user's downloaded player based on the user's operating system version. Just let Win2000 users download Media Player 9.
Okay, the cause of the problem has been found, and solving the problem is very simple.
The following mainly talks about how to use JavaScript to determine the user’s operating system and version.
Key parts:
window.navigator.userAgent: User browser, operating system and other information, corresponding to the User-Agent part of the HTML request file header.
Code part:


Remarks:
Several values ​​of window.navigator.userAgent:
1) WinXP IE7: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; CIBA; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
2) WinXP FF3.0: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv :1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)
3) Win2000 IE6: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
4) Win2000 FF3. 1:Mozilla/5.0 (Windows; U; Windows NT 5.0; zh-CN; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2 The above values ​​are for reference only to understand the code. Please test the specific values. It is better to believe all the books than to have no books at all, and it is better to believe what others say than to believe what you do, haha

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The difference between char and wchar_t in C language The difference between char and wchar_t in C language Apr 03, 2025 pm 03:09 PM

In C language, the main difference between char and wchar_t is character encoding: char uses ASCII or extends ASCII, wchar_t uses Unicode; char takes up 1-2 bytes, wchar_t takes up 2-4 bytes; char is suitable for English text, wchar_t is suitable for multilingual text; char is widely supported, wchar_t depends on whether the compiler and operating system support Unicode; char is limited in character range, wchar_t has a larger character range, and special functions are used for arithmetic operations.

Four ways to implement multithreading in C language Four ways to implement multithreading in C language Apr 03, 2025 pm 03:00 PM

Multithreading in the language can greatly improve program efficiency. There are four main ways to implement multithreading in C language: Create independent processes: Create multiple independently running processes, each process has its own memory space. Pseudo-multithreading: Create multiple execution streams in a process that share the same memory space and execute alternately. Multi-threaded library: Use multi-threaded libraries such as pthreads to create and manage threads, providing rich thread operation functions. Coroutine: A lightweight multi-threaded implementation that divides tasks into small subtasks and executes them in turn.

c What are the differences between the three implementation methods of multithreading c What are the differences between the three implementation methods of multithreading Apr 03, 2025 pm 03:03 PM

Multithreading is an important technology in computer programming and is used to improve program execution efficiency. In the C language, there are many ways to implement multithreading, including thread libraries, POSIX threads, and Windows API.

Can you use Tauri to develop desktop applications if you don't know Rust? Can you use Tauri to develop desktop applications if you don't know Rust? Apr 04, 2025 pm 11:42 PM

The impact of Rust language proficiency on desktop program development under the Tauri framework Tauri is a desktop application development framework built using Rust, thanks to its lightweight and...

Copy and paste Love code Copy and paste Love code for free Copy and paste Love code Copy and paste Love code for free Apr 04, 2025 am 06:48 AM

Copying and pasting the code is not impossible, but it should be treated with caution. Dependencies such as environment, libraries, versions, etc. in the code may not match the current project, resulting in errors or unpredictable results. Be sure to ensure the context is consistent, including file paths, dependent libraries, and Python versions. Additionally, when copying and pasting the code for a specific library, you may need to install the library and its dependencies. Common errors include path errors, version conflicts, and inconsistent code styles. Performance optimization needs to be redesigned or refactored according to the original purpose and constraints of the code. It is crucial to understand and debug copied code, and do not copy and paste blindly.

What are the differences between asynchronous and multithreading What are the differences between asynchronous and multithreading Apr 03, 2025 pm 02:48 PM

Asynchronous and multithreading are completely different concepts in C#. Asynchronously pay attention to task execution order, and multithreads pay attention to task execution in parallel. Asynchronous operations avoid blocking the current thread by coordinating task execution, while multithreads execute tasks in parallel by creating new threads. Asynchronous is more suitable for I/O-intensive tasks, while multithreading is more suitable for CPU-intensive tasks. In practical applications, asynchronous and multithreading are often used to optimize program performance. Pay attention to avoid deadlocks, excessive use of asynchronous, and rational use of thread pools.

C language conditional compilation: a detailed guide for beginners to practical applications C language conditional compilation: a detailed guide for beginners to practical applications Apr 04, 2025 am 10:48 AM

C language conditional compilation is a mechanism for selectively compiling code blocks based on compile-time conditions. The introductory methods include: using #if and #else directives to select code blocks based on conditions. Commonly used conditional expressions include STDC, _WIN32 and linux. Practical case: Print different messages according to the operating system. Use different data types according to the number of digits of the system. Different header files are supported according to the compiler. Conditional compilation enhances the portability and flexibility of the code, making it adaptable to compiler, operating system, and CPU architecture changes.

The difference between H5 and mini-programs and APPs The difference between H5 and mini-programs and APPs Apr 06, 2025 am 10:42 AM

H5. The main difference between mini programs and APP is: technical architecture: H5 is based on web technology, and mini programs and APP are independent applications. Experience and functions: H5 is light and easy to use, with limited functions; mini programs are lightweight and have good interactiveness; APPs are powerful and have smooth experience. Compatibility: H5 is cross-platform compatible, applets and APPs are restricted by the platform. Development cost: H5 has low development cost, medium mini programs, and highest APP. Applicable scenarios: H5 is suitable for information display, applets are suitable for lightweight applications, and APPs are suitable for complex functions.

See all articles