更詳細(xì)的信息可以去查msdn或者Navigator 2.0以后的說明文檔,這里我們之做個(gè)簡單的說明
包括一下幾大屬性:
- appCodeName 返回瀏覽器的“碼名”(?),流行的 IE 和 NN 都返回 'Mozilla'。
下面的例子顯示了 appCodeName 屬性的值:document.write("navigator.appCodeName 的值是" + navigator.appCodeName)
- appName 返回瀏覽器名。IE 返回 'Microsoft Internet Explorer',NN 返回 'Netscape'。
下面的例子顯示了 appName 屬性的值:document.write("navigator.appName 的值是 " + navigator.appName)
- appVersion 返回瀏覽器版本,包括了大版本號、小版本號、語言、操作平臺等信息。
- language 語言
- mimeType 以數(shù)組表示所支持的MIME類型
- platform 返回瀏覽器的操作平臺,對于 Windows 9x 上的瀏覽器,返回 'Win32'(大小寫可能有差異)。
- userAgent 返回以上全部信息。例如,IE5.01 返回 'Mozilla/4.0 (compatible; MSIE 5.01; Windows 98)'。
- plugins 以數(shù)組表示已安裝的外掛程序
- javaEnabled() 返回一個(gè)布爾值,代表當(dāng)前瀏覽器允許不允許 Java。
檢測瀏覽器的版本、所支持的MIME類型、已安裝的外掛程序(plug-in)。該對象包含兩個(gè)子對象:外掛對象、MIME類型對象。
例如:












例如:








Screen
基本JavaScript的Screen屏幕對象
- screen 屏幕對象 反映了當(dāng)前用戶的屏幕設(shè)置。
- width 返回屏幕的寬度(像素?cái)?shù))。
- height 返回屏幕的高度。
- availWidth 返回屏幕的可用寬度(除去了一些不自動隱藏的類似任務(wù)欄的東西所占用的寬度)。
- availHeight 返回屏幕的可用高度。
- colorDepth 返回當(dāng)前顏色設(shè)置所用的位數(shù) - 1:黑白;8:256色;16:增強(qiáng)色;24/32:真彩色
下面是英文的Navigator瀏覽器的屏幕對象:
- availHeight:minus permanent or semipermanent user interface features displayed by the operating system:such as the Taskbar on Windows.
- availWidth:Specifies the width of the screen, in pixels, minus permanent or semipermanent user interface:features displayed by the operating system, such as the Taskbar on Windows.
- colorDepth:The bit depth of the color palette, if one is in use; otherwise, the value is derived from screen.pixelDepth.
- height:Display screen height.
- pixelDepth:Display screen color resolution (bits per pixel).
- width:Display screen width.
History
JavaScript中的History歷史對象包含了用戶已瀏覽的 URL 的信息,是指歷史對象指瀏覽器的瀏覽歷史。鑒于安全性的需要,該對象收到很多限制,現(xiàn)在只剩下下列屬性和方法。History歷史對象有l(wèi)ength這個(gè)屬性,列出歷史的項(xiàng)數(shù)。JavaScript 所能管到的歷史被限制在用瀏覽器的“前進(jìn)”“后退”鍵可以去到的范圍。本屬性返回的是“前進(jìn)”和“后退”兩個(gè)按鍵之下包含的地址數(shù)的和。
History歷史對象并有以下方法
- back() 后退,跟按下“后退”鍵是等效的。
- forward() 前進(jìn),跟按下“前進(jìn)”鍵是等效的。
- go() 用法:history.go(x);在歷史的范圍內(nèi)去到指定的一個(gè)地址。如果 x < 0,則后退 x 個(gè)地址,如果 x > 0,則前進(jìn) x 個(gè)地址,如果 x == 0,則刷新現(xiàn)在打開的網(wǎng)頁。history.go(0) 跟 location.reload() 是等效的。