The navigator object contains information about the browser.
Navigator object attributes:
Attribute |
Description |
IE |
F |
O |
Appcodename |
Return to the browser'sCodeName. |
4 |
1 |
9 |
Appminorversion |
Returns the secondary version of the browser. |
4 |
No |
No |
Appname |
Returns the name of the browser. |
4 |
1 |
9 |
Appversion |
Return the platform and version information of the browser. |
4 |
1 |
9 |
Browserlanguage |
Returns the language of the current browser. |
4 |
No |
9 |
Cookieenabled |
Returns a Boolean value indicating whether the cookie is enabled in the browser. |
4 |
1 |
9 |
Cpuclass |
Returns the CPU level of the browser system. |
4 |
No |
No |
Online |
Returns a Boolean value indicating whether the system is in offline mode. |
4 |
No |
No |
Platform |
Return to the operating system platform that runs the browser. |
4 |
1 |
9 |
Systemlanguage |
Returns the default OS language. |
4 |
No |
No |
Useragent |
Returns the value of the User-Agent header of the server sent by the client. |
4 |
1 |
9 |
Userlanguage |
Returns the OS's natural language settings. |
4 |
No |
9 |
Navigator object method:
Method |
Description |
IE |
F |
O |
Javaenabled () |
Specifies whether the browser enables Java. |
4 |
1 |
9 |
Taintenabled () |
Specifies whether the browser enables data tainting ). |
4 |
1 |
9 |
IE test results:
Test results of Firefox:
Obtain the specific IE version:
Function Checkieversion (){
VaR UA = Navigator. useragent;
VaR S = " MSIE " ;
VaR I = UA. indexof (s)
If (I > = 0 ){
// Get IE version number
VaR Ver = Parsefloat (UA. substr (I + S. Length ));
Alert ( " Your browser is IE " + Ver );
}
Else {
// In other cases, it is not IE
Alert ( " Your browser is not IE " );
}
}
Whether to enable the pop-up window to blockProgram:
Function Checkallowpopup (){
VaR Objchild;
VaR Rework = New Regexp ( ' Object ' , ' Gi ' );
Try {
Objchild = Window. Open ( '' , ' Child ' , ' Left = 8000, Top = 8000, width = 50, Height = 50, status = No, resizable = Yes ' );
Objchild. Close ();
}
Catch (E ){}
If ( ! Rework. Test (string (objchild )))
{
Alert ( " No " );
Return False ;
}
Else
{
Alert ( " Yes " );
Return True ;
}
}