In the afternoon, I went to the user's site and felt that the problem was indeed quite strange. Finally, I found that the computer with the problem was Windows 2000, and I felt that the problem was probably caused by google surfing the Internet, it is found that Media Player 11 does not support the Win2000 system. You need to determine the version of the Player you want to download based on your operating system, so that Win2000 users can download Media Player 9.
Well, the cause of the problem is found. Solving the problem is very simple.
The following describes how to use JavaScript to determine the user's operating system and version.
Key part:
Window. navigator. userAgent: information such as the User's browser and operating system, corresponding to the User-Agent section of the HTML request file header.
Code Section:
<Script language = "javascript">
Var ua = window. navigator. userAgent;
Var osVersion = ua. split (";") [2];
Var osV = osVersion. substr (osVersion. length-3, 3 );
Switch (osV)
{
Case "5.0 ":
Document. write ("Win2000 ");
Break;
Case "5.1 ":
Document. write ("WinXP ");
Break;
Case "5.2 ":
Document. write ("Win2003 ");
Break;
Default:
Document. write ("Others ");
Break;
}
</Script>
Note:
Window. navigator. userAgent values:
1) WinXP + IE7: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; CIBA;. net clr 2.0.50727;. net clr 3.0.20.6.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, so that you can understand the code. Test the specific values. Believe in books as much as you do, and believe in what others say as well as your own.