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

WBOY
Release: 2016-05-16 18:47:40
Original
1182 people have browsed it

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

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template