Due to the Windows XP patch SP2, a lot of improvements have been made to the security of IE6, which makes many functions that we can use before become very strange or even discontinued :(. Especially pop-up windows and modal windows. and Popup windows are greatly affected. So can I determine whether the IE6 the user is using is ordinary IE6 (IE6sp1) or IE6 xp sp2?
The following are two typical IE6 browser UserAgent fields:
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 these two UA strings and ordinary UA strings is that there is an additional "SV1" mark in them. What does this mean? The original meaning of SV1 is "Security Version 1", which is used to specifically mark whether the operating system used by users using the IE6 browser is XPSP2 or WS03SP1.
Since XPSP2 and WS03SP1 have an impact on IE6, why not increase the version number of IE instead of using SVX annotation alone? The IE development team explained this. They said that although the patches for these two operating systems have an impact on the settings of IE6, they do not modify any functions of IE6 itself, such as rendering, DHTML and DOM. Therefore, some of these security settings are not suitable for upgrading the version number of IE itself.
In subsequent IE versions, the SVX logo 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
}
}