Home > Web Front-end > JS Tutorial > Navigator browser object in JavaScript_Basic knowledge

Navigator browser object in JavaScript_Basic knowledge

WBOY
Release: 2016-05-16 19:06:32
Original
1216 people have browsed it

The navigator browser object contains the version information of the Navigator being used. Reflects the profile of the browser currently in use. The JavaScript client runtime engine automatically creates navigator objects.
For more detailed information, you can check msdn or the documentation of Navigator 2.0 and later. Here we will make a simple explanation
Including several major attributes:



appCodeName Return The browser's "code name" (?), the popular IE and NN both return 'Mozilla'.
The following example shows the value of the appCodeName attribute:
document.write("The value of navigator.appCodeName is" navigator.appCodeName)

appName returns the browser name. IE returns 'Microsoft Internet Explorer', NN returns 'Netscape'.
The following example shows the value of the appName attribute:
document.write("The value of navigator.appName is " navigator.appName)

appVersion returns the browser version, including the major version number, Information such as minor version number, language, operating platform, etc.

language language

mimeType represents the supported MIME types as an array

platform returns the operating platform of the browser, for browsers on Windows 9x, returns 'Win32' ( Case may vary).

userAgent returns all the above information. For example, IE5.01 returns 'Mozilla/4.0 (compatible; MSIE 5.01; Windows 98)'.

plugins represents the installed plug-ins as an array

javaEnabled() returns a Boolean value, indicating that the current browser allows or disallows Java.


Detect the browser version, supported MIME types, and installed plug-ins. This object contains two sub-objects: plug-in object and MIME type object.
For example:


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]


For example:

[Ctrl A select all Note:
If you need to introduce external Js, you need to refresh to execute <script> with (document) { write ("你的浏览器信息:<OL>"); write ("<LI>代码:"+navigator.appCodeName); write ("<LI>名称:"+navigator.appName); write ("<LI>版本:"+navigator.appVersion); write ("<LI>语言:"+navigator.language); write ("<LI>编译平台:"+navigator.platform); write ("<LI>用户表头:"+navigator.userAgent); } </script>]<script> if (document.all) { document.write("你的浏览器是:MSIE"); } else { document.write("你的浏览器是:Navigator"); } </script>
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