aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/navigator/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/navigator/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/navigator/index.html')
-rw-r--r--files/zh-cn/web/api/navigator/index.html172
1 files changed, 172 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/navigator/index.html b/files/zh-cn/web/api/navigator/index.html
new file mode 100644
index 0000000000..a68d752556
--- /dev/null
+++ b/files/zh-cn/web/api/navigator/index.html
@@ -0,0 +1,172 @@
+---
+title: Navigator
+slug: Web/API/Navigator
+tags:
+ - API
+ - DOM4
+ - Navigator
+ - 接口
+translation_of: Web/API/Navigator
+---
+<p>{{apiref("DOM4")}}</p>
+
+<p><code>Navigator</code> 接口表示用户代理的状态和标识。 它允许脚本查询它和注册自己进行一些活动。</p>
+
+<p>可以使用只读的 {{domxref("window.navigator")}} 属性检索navigator对象。</p>
+
+<h2 id="属性">属性</h2>
+
+<p>不从<em>{{domxref("NavigatorID")}}, {{domxref("NavigatorLanguage")}}, {{domxref("NavigatorOnLine")}}, {{domxref("NavigatorGeolocation")}}, {{domxref("NavigatorPlugins")}}, {{domxref("NavigatorUserMedia")}}, </em>和 <em>{{domxref("NetworkInformation")}} </em>中继承任何属性,但是实现了定义在这些对象中的如下属性。</p>
+
+<h3 id="标准属性">标准属性</h3>
+
+<dl>
+ <dt>{{domxref("Navigator.activeVRDisplays")}} {{readonlyInline}}{{experimental_inline}}</dt>
+ <dd>筛选所有的 {{domxref("VRDisplay")}} 对象,把其中所有{{domxref("VRDisplay.ispresenting")}}属性的值为<code>true</code>的对象以数组的形式返回。 </dd>
+ <dt>{{domxref("NavigatorID.appCodeName")}} {{readonlyInline}}{{deprecated_inline}}</dt>
+ <dd>返回当前浏览器的内部“开发代号”名称。 不能保证此属性返回的值是正确的。</dd>
+ <dt>{{domxref("NavigatorID.appName")}} {{readonlyInline}}{{deprecated_inline}}</dt>
+ <dd>以 {{domxref("DOMString")}} 的形式返回浏览器官方名称。 不能保证此属性返回的值是正确的。</dd>
+ <dt>{{domxref("NavigatorID.appVersion")}} {{readonlyInline}}{{deprecated_inline}}</dt>
+ <dd>以 {{domxref("DOMString")}} 的形式返回浏览器版本。不能保证此属性返回的值是正确的。</dd>
+ <dt>{{domxref("Navigator.battery")}} {{readonlyInline}}{{deprecated_inline}}</dt>
+ <dd>返回一个 {{domxref("BatteryManager")}} 对象,你可以用它来获取一些电池充电状态的信息。</dd>
+ <dt>{{domxref("Navigator.connection")}} {{readonlyInline}}{{experimental_inline}}</dt>
+ <dd>提供一个{{domxref("NetworkInformation")}}对象来获取设备的网络连接信息。</dd>
+ <dt>{{domxref("Navigator.cookieEnabled")}} {{readonlyinline}}</dt>
+ <dd>当忽略 cookie 时返回 false,否则返回 true</dd>
+ <dt>{{domxref("Navigator.geolocation")}} {{readonlyInline}}</dt>
+ <dd>返回一个 {{domxref("Geolocation")}} 对象,据之可访问设备的地理位位置信息。</dd>
+ <dt>{{domxref("NavigatorConcurrentHardware.hardwareConcurrency")}} {{readOnlyInline}}</dt>
+ <dd>返回可用的逻辑处理器核心数。</dd>
+ <dt>{{domxref("NavigatorPlugins.javaEnabled")}} {{readonlyInline}}{{experimental_inline}}</dt>
+ <dd>返回{{domxref("Boolean")}}表明浏览器是否支持Java。</dd>
+ <dt>{{domxref('Navigator.keyboard')}} {{readonlyinline}} {{experimental_inline}}</dt>
+ <dd>返回一个{{domxref("Keyboard")}}对象,该对象提供对以下功能的访问:检索键盘布局图和切换从物理键盘捕获按键的功能。</dd>
+ <dt>{{domxref("NavigatorLanguage.language")}} {{readonlyInline}}</dt>
+ <dd>返回{{domxref("DOMString")}}表示用户的首先语言,通常是浏览器用户界面的语言。当未知的时,返回null。</dd>
+ <dt>{{domxref("NavigatorLanguage.languages")}} {{readonlyInline}}</dt>
+ <dd> 返回一个表示用户已知语言的{{domxref("DOMString")}}数组,并按优先顺序排列。</dd>
+ <dt>{{domxref("NavigatorPlugins.mimeTypes")}} {{readonlyInline}}{{experimental_inline}}</dt>
+ <dt>{{domxref("Navigator.locks")}} {{readonlyinline}}{{experimental_inline}}</dt>
+ <dd>Returns a {{domxref("LockManager")}} object which provides methods for requesting a new {{domxref('Lock')}} object and querying for an existing {{domxref('Lock')}} object</dd>
+ <dt>{{domxref("Navigator.mediaCapabilities")}} {{readonlyinline}}{{experimental_inline}}</dt>
+ <dd>Returns a {{domxref("MediaCapabilities")}} object that can expose information about the decoding and encoding capabilities for a given format and output capabilities.</dd>
+ <dt>{{domxref("Navigator.maxTouchPoints")}} {{readonlyInline}}</dt>
+ <dd>Returns the maximum number of simultaneous touch contact points are supported by the current device.</dd>
+ <dd>返回{{domxref("MimeTypeArray")}}数组用于列举浏览器所支持的MIME类型。</dd>
+ <dt>{{domxref("NavigatorOnLine.onLine")}} {{readonlyInline}}</dt>
+ <dd>返回{{domxref("Boolean")}}来表明浏览器是否联网。</dd>
+ <dt>{{domxref("Navigator.oscpu")}}</dt>
+ <dd>返回当前操作系统名。</dd>
+ <dt>{{domxref("Navigator.permissions")}} {{readonlyinline}}{{experimental_inline}}</dt>
+ <dd>返回一个{{domxref("Permissions")}}对象,该对象可用于查询和更新<a href="/en-US/docs/Web/API/Permissions_API">Permissions API</a>涵盖的API的权限状态。</dd>
+ <dt>{{domxref("NavigatorID.platform")}} {{readonlyInline}}{{experimental_inline}}</dt>
+ <dd>返回浏览器平台名,不确定此值是否有效。</dd>
+ <dt>{{domxref("NavigatorPlugins.plugins")}} {{readonlyInline}}{{experimental_inline}}</dt>
+ <dd>返回{{domxref("PluginArray")}}数组用于列举出浏览器安装的插件。</dd>
+ <dt>{{domxref("NavigatorID.product")}} {{readonlyInline}} {{experimental_inline}}</dt>
+ <dd>在任意浏览器下都只返回<code>'Gecko'</code>,此属性只用于兼容的目的。</dd>
+ <dt>{{domxref("Navigator.serviceWorker")}} {{readonlyInline}}</dt>
+ <dd>返回{{domxref("ServiceWorkerContainer")}} 对象用于提供注册、删除、更新以及为了<a href="https://html.spec.whatwg.org/multipage/browsers.html#concept-document-window">associated document</a>的{{domxref("ServiceWorker")}}对象之间的通信。</dd>
+ <dt>{{domxref("NavigatorStorage.storage")}} {{readonlyinline}}</dt>
+ <dd>Returns the singleton {{domxref('StorageManager')}} object used for managing persistence permissions and estimating available storage on a site-by-site/app-by-app basis.</dd>
+ <dt>{{domxref("NavigatorID.userAgent")}} {{readonlyInline}}</dt>
+ <dd>返回当前浏览器的用户代理。</dd>
+ <dt>{{domxref("Navigator.webdriver")}} {{readonlyInline}} {{experimental_inline}}</dt>
+</dl>
+
+<h3 id="Methods" name="Methods">非标准方法</h3>
+
+<dl>
+ <dt>{{domxref("window.navigator.buildID", "navigator.buildID")}} {{non-standard_inline}}</dt>
+ <dd>返回浏览器识别码。这一方法返回时间戳,例如,在Firefox 64发行版中返回"<code>20181001000000</code>"。.</dd>
+ <dt>{{domxref("Navigator.cookieEnabled")}} {{non-standard_inline}}</dt>
+ <dd>返回布尔值以表明cookies是否能再浏览器中启用</dd>
+ <dt>{{domxref("navigator.doNotTrack")}} {{non-standard_inline}}</dt>
+ <dd>报告用户的不追踪参数值,当值为yes,你的网址或应用将不追踪用户</dd>
+ <dt>{{domxref("navigator.id")}} {{non-standard_inline}}</dt>
+ <dd>返回 {{domxref("window.navigator.id", "id")}} 对象, 你能用 <a href="/en-US/docs/BrowserID" title="BrowserID">BrowserID</a> 添加支持 到你的网址</dd>
+ <dt>{{domxref("window.navigator.mozApps", "navigator.mozApps")}} {{non-standard_inline}}</dt>
+ <dd>Returns an {{domxref("window.navigator.mozApps", "Apps")}} object you can use to install, manage, and control <a href="/Open_Web_Apps" title="Open Web apps">Open Web apps</a>.</dd>
+ <dt>{{domxref("Navigator.mozAudioChannelManager", "navigator.mozAudioChannelManager")}} {{non-standard_inline}}</dt>
+ <dd>The <code>navigator.mozAudioChannelManager</code> object provides access to the {{domxref("mozAudioChannelManager")}} interface, which is used to manage your Firefox OS device's audio channels, including setting what channel's volume to affect when the volume buttons are pressed inside a particular app.</dd>
+ <dt>{{domxref("window.navigator.mozNotification","navigator.mozNotification")}} {{deprecated_inline("22")}} {{non-standard_inline}}<br>
+ {{domxref("window.navigator.webkitNotification","navigator.webkitNotification")}}</dt>
+ <dd>Returns a {{domxref("navigator.mozNotification", "notification")}} object you can use to deliver notifications to the user from your web application.</dd>
+ <dt>{{domxref("navigator.mozSocial")}} {{non-standard_inline}}</dt>
+ <dd>The Object, returned by the <code>navigator.mozSocial</code> property, is available within the social media provider's panel to provide functionality it may need.</dd>
+ <dt>{{domxref("window.navigator.productSub", "navigator.productSub")}} {{non-standard_inline}}</dt>
+ <dd>Returns the build number of the current browser (e.g., "20060909").</dd>
+ <dt>{{domxref("window.navigator.securitypolicy", "navigator.securitypolicy")}} {{non-standard_inline}}</dt>
+ <dd>Returns an empty string. In Netscape 4.7x, returns "US &amp; CA domestic policy" or "Export policy".</dd>
+ <dt>{{domxref("window.navigator.standalone", "navigator.standalone")}} {{non-standard_inline}}</dt>
+ <dd>Returns a boolean indicating whether the browser is running in standalone mode. Available on Apple's iOS Safari only.</dd>
+ <dt>{{domxref("window.navigator.vendor", "navigator.vendor")}} {{non-standard_inline}}</dt>
+ <dd>返回当前浏览器的供应商的名字(例如:“Netscape6”)。</dd>
+ <dt>{{domxref("window.navigator.vendorSub", "navigator.vendorSub")}} {{non-standard_inline}}</dt>
+ <dd>返回供应商版本号码(例如:“6.1”)。</dd>
+ <dt><a href="/en-US/docs/API/Pointer_Lock_API" title="Mouse Lock API"><code>navigator.webkitPointer</code></a> {{non-standard_inline}}</dt>
+ <dd>Returns a PointerLock object for the <a href="/en-US/docs/API/Pointer_Lock_API" title="Mouse Lock API">Mouse Lock API</a>.</dd>
+</dl>
+
+<h2 id="Methods" name="Methods">方法</h2>
+
+<p><em>Doesn't inherit any method, but implements those defined in {{domxref("NavigatorID")}}, {{domxref("NavigatorContentUtils")}}, <em>{{domxref("NavigatorUserMedia")}}, </em>and {{domxref("NavigatorStorageUtils")}}.</em></p>
+
+<h3 id="标准方法">标准方法</h3>
+
+<dl>
+ <dt>{{domxref("Navigator.getVRDisplays()")}} {{deprecated_inline}}</dt>
+ <dd>Returns a promise that resolves to an array of {{domxref("VRDisplay")}} objects representing any available VR devices connected to the computer.</dd>
+ <dt>{{domxref("NavigatorUserMedia.getUserMedia()")}}{{deprecated_inline}}</dt>
+ <dd>After having prompted the user for permission, returns the audio or video stream associated to a camera or microphone on the local computer.</dd>
+ <dt>{{domxref("window.navigator.registerContentHandler", "navigator.registerContentHandler")}}</dt>
+ <dd>Allows web sites to register themselves as a possible handler for a given MIME type.</dd>
+ <dt>{{domxref("navigator.registerProtocolHandler", "navigator.registerProtocolHandler")}}</dt>
+ <dd>Allows web sites to register themselves as a possible handler for a given protocol.</dd>
+ <dt>{{domxref("Navigator.requestMediaKeySystemAccess()")}} {{experimental_inline}}</dt>
+ <dd>Returns a {{jsxref("Promise")}} for a MediaKeySystemAccess object.</dd>
+ <dt>{{domxref("Navigator.sendBeacon()")}}{{experimental_inline}}</dt>
+ <dd>Used to asynchronously transfer a small amount of data using {{Glossary("HTTP")}} from the User Agent to a web server.</dd>
+ <dt>{{domxref("Navigator.share()")}}{{experimental_inline}}</dt>
+ <dd>Invokes the native sharing mechanism of the current platform.</dd>
+ <dt>{{domxref("NavigatorID.taintEnabled()")}} {{deprecated_inline("1.7.8")}} {{obsolete_inline("9.0")}} {{experimental_inline}}</dt>
+ <dd>Returns <code>false</code>. JavaScript taint/untaint functions removed in JavaScript 1.2.</dd>
+ <dt>{{domxref("Navigator.vibrate()")}} {{gecko_minversion_inline("11.0")}}</dt>
+ <dd>Causes vibration on devices with support for it. Does nothing if vibration support isn't available.</dd>
+</dl>
+
+<h3 id="Specification" name="Specification">非标准方法</h3>
+
+<dl>
+ <dt>{{domxref("window.navigator.mozIsLocallyAvailable", "navigator.mozIsLocallyAvailable")}} {{non-standard_inline}}</dt>
+ <dd>Lets code check to see if the document at a given URI is available without using the network.</dd>
+ <dt>{{domxref("window.navigator.mozPay", "navigator.mozPay")}} {{non-standard_inline}}</dt>
+ <dd>Allows in-app payment.</dd>
+</dl>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', '#the-navigator-object', 'the Navigator object')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div class="hidden">The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</div>
+
+<div>{{Compat("api.Navigator")}}</div>