Navigator 瀏覽器對象,包含了正在使用的 Navigator 的版本信息。反映了當(dāng)前使用的瀏覽器的資料。JavaScript 客戶端運(yùn)行時(shí)刻引擎自動創(chuàng)建 navigator 對象。
          更詳細(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類型對象。
          例如:

          <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> 

          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() 是等效的。


          posted on 2007-12-03 18:43 湘江夜游神 閱讀(501) 評論(0)  編輯  收藏 所屬分類: JavaScript

          Locations of visitors to this page

          主站蜘蛛池模板: 高陵县| 和平区| 安康市| 四子王旗| 蒙阴县| 灌云县| 格尔木市| 崇阳县| 福海县| 汤原县| 太康县| 府谷县| 陇西县| 颍上县| 黄山市| 彩票| 新平| 台江县| 疏附县| 航空| 肥乡县| 新昌县| 阳信县| 保德县| 阿克陶县| 洛南县| 定陶县| 富蕴县| 资源县| 南投市| 辉县市| 台北县| 安图县| 鄄城县| 宁强县| 黄陵县| 额敏县| 高清| 霍城县| 清苑县| 阜城县|