Use js to determine whether your browser is an IE6_javascript skill of XP SP2

Source: Internet
Author: User
Js is used to determine whether your browser is an Internet Explorer of XP SP2. Due to the Windows XP patch SP2, the security of Internet Explorer 6 has also been improved a lot, so there are many functions that we can use in the past, it will become very strange or even take a rest :(. In particular, pop-up windows, modal windows, and Popup windows are greatly affected. So can I determine whether the Internet Explorer 6 is Internet Explorer 6 (IE6sp1) or Internet Explorer 6 + xp sp2?

The following are two typical UserAgent fields in the IE 6 Browser:

1. Windows XP + SP1 (NT 5.1)
Connection: Keep-Alive
Accept :*/*
Accept-Encoding: gzip, deflate
Accept-Language: zh-cn
Host: zhilee.aehk.com
Referer: http://www.cnblogs.com/birdshome/archive/2005/03/11/113723.html
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;. net clr 1.1.4322)
2. Windows 2003 + SP1 (NT 5.2)
Connection: Keep-Alive
Accept :*/*
Accept-Encoding: gzip, deflate
Accept-Language: zh-cn
Host: zhilee.aehk.com
Referer: http://www.cnblogs.com/bluefee/archive/2005/03/28/127455.html
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1;. net clr 1.1.4322)
UA-CPU: x86
The biggest difference between the two UA strings and the ordinary UA string is that there is a "SV1" sign in it. What does this mean? SV1 is intended to be "Security Version 1", which is used to indicate whether the operating system used by users using the IE 6 browser is XP SP2 or WS03SP1.

Since XP SP2 and WS03SP1 have an impact on IE6, why not upgrade the IE version, but use SVX annotation separately? The IE Development Team explained this by saying that although the patches of these two operating systems have an impact on the settings of IE6, they did not modify any features of IE6, such as rendering, DHTML, and DOM. Therefore, some such security settings are not suitable for upgrading the version number of IE itself.

In subsequent IE versions, the SVX flag may be removed, so currently we use UA string to detect the SP version of the operating system, which is only a temporary method.

Var ua = navigator. userAgent;
If (ua. indexOf ("SV1 ")! =-1)
{
If (ua. indexOf ("NT 5.1 ")! =-1)
{
// Windows xp + sp2
}
Else if (ua. indexOf ("NT 5.2 ")! =-1)
{
// Windows 2003 + sp1
}
Else
{
// Wrong user agent string
}
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.