Navigator对象

Navigator对象包含有关浏览器的信息。虽然没有应用于Navigator对象的公开标准,不过,所有浏览器都支持该对象。

     appCodeName                        与浏览器相关的内部代码名
     appMinorVersion                     辅版本号
     appName                                浏览器的正式名称
     appVersion                             浏览器的版本号
     cookieEnabled                        支持cookie返回true,否则为false
     cpuClass                                浏览器正在运行的计算机的cpu型号
     language                                浏览器支持的语言
     mimeTypes                             浏览器支持的所有MIME类型的数组
     onLine                                    浏览器当前为在线模式,返回true,否则为false
     opsProfile                               未定义
     oscpu                                     浏览器正在运行的操作系统
     platform                                  浏览器正在运行的操作平台
     plugins                                    浏览器安装插件的数组
     product                                   浏览器的产品名
     productSub                             与浏览器产品相关的更多信息
     securityPolicy                         浏览器支持的加密类型
     systemLanguage                    操作系统的默认语言
     userAgent                              包含多项属性中的所有或一部分
     userLanguage                        用户在自己的系统上设置的语言
     userProfile                              返回一个UserProfile对象,它存储用户的个人信息
     vendor                                    制作浏览器的公司
     vendorSub                             关于浏览器制作厂商的更多信息


需要注意的是,每个浏览器的Navigator对象所包含的属性并不相同。


新建一个网页navigator.html:

<html>
<body>
	<script type="text/javascript">
		for (var i in window.navigator) {
			document.write("navigator." + i + " = " +window.navigator[i] + "<br />");
		}
	</script>
</body>
</html>

分别用不同的浏览器打开,就返回各浏览器Navigator对象包含的属性值。

chrome:

navigator.language = zh-CN
navigator.product = Gecko
navigator.mimeTypes = [object DOMMimeTypeArray]
navigator.appVersion = 5.0 (Windows NT 6.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.66 Safari/535.11
navigator.plugins = [object DOMPluginArray]
navigator.onLine = true
navigator.platform = Win32
navigator.vendor = Google Inc.
navigator.appCodeName = Mozilla
navigator.cookieEnabled = true
navigator.geolocation = [object Geolocation]
navigator.appName = Netscape
navigator.productSub = 20030107
navigator.userAgent = Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.66 Safari/535.11
navigator.vendorSub = 
navigator.javaEnabled = function javaEnabled() { [native code] }
navigator.getStorageUpdates = function getStorageUpdates() { [native code] }
navigator.registerProtocolHandler = function registerProtocolHandler() { [native code] }


firefox:

navigator.appCodeName = Mozilla
navigator.appName = Netscape
navigator.appVersion = 5.0 (Windows)
navigator.language = zh-CN
navigator.mimeTypes = [object MimeTypeArray]
navigator.platform = Win32
navigator.oscpu = Windows NT 6.1
navigator.vendor =
navigator.vendorSub =
navigator.product = Gecko
navigator.productSub = 20100101
navigator.plugins = [object PluginArray]
navigator.userAgent = Mozilla/5.0 (Windows NT 6.1; rv:8.0.1) Gecko/20100101 Firefox/8.0.1
navigator.cookieEnabled = true
navigator.onLine = true
navigator.buildID = 20111120135848
navigator.javaEnabled = function javaEnabled() { [native code] }
navigator.taintEnabled = function taintEnabled() { [native code] }
navigator.geolocation = [object GeoGeolocation]
navigator.registerContentHandler = function registerContentHandler() { [native code] }
navigator.registerProtocolHandler = function registerProtocolHandler() { [native code] }
navigator.mozIsLocallyAvailable = function mozIsLocallyAvailable() { [native code] }

opera:

navigator.appCodeName = Mozilla
navigator.appMinorVersion = 
navigator.appName = Opera
navigator.appVersion = 9.80 (Windows NT 6.1; U; zh-cn)
navigator.browserLanguage = zh-cn
navigator.cookieEnabled = true
navigator.geolocation = [object Geolocation]
navigator.language = zh-cn
navigator.mimeTypes = [object MimeTypes]
navigator.onLine = true
navigator.platform = Win32
navigator.plugins = [object PluginArray]
navigator.userAgent = Opera/9.80 (Windows NT 6.1; U; zh-cn) Presto/2.9.168 Version/11.52
navigator.userLanguage = zh-cn
navigator.javaEnabled = function javaEnabled() { [native code] }
navigator.taintEnabled = function taintEnabled() { [native code] }


Safari:

navigator.geolocation = [object Geolocation]
navigator.cookieEnabled = true
navigator.language = zh-CN
navigator.productSub = 20030107
navigator.product = Gecko
navigator.appCodeName = Mozilla
navigator.mimeTypes = [object MimeTypeArray]
navigator.vendorSub = 
navigator.vendor = Apple Computer, Inc.
navigator.platform = Win32
navigator.appName = Netscape
navigator.appVersion = 5.0 (Windows; U; Windows NT 6.1; zh-CN) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
navigator.userAgent = Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
navigator.plugins = [object PluginArray]
navigator.onLine = true
navigator.javaEnabled = function javaEnabled() { [native code] }
navigator.getStorageUpdates = function getStorageUpdates() { [native code] }
navigator.registerProtocolHandler = function registerProtocolHandler() { [native code] }
navigator.registerContentHandler = function registerContentHandler() { [native code] }





你可能感兴趣的:(windows,function,浏览器,object,Safari,plugins)