diff options
Diffstat (limited to 'files/zh-cn/orphaned/web/api/navigatorplugins')
4 files changed, 273 insertions, 0 deletions
diff --git a/files/zh-cn/orphaned/web/api/navigatorplugins/index.html b/files/zh-cn/orphaned/web/api/navigatorplugins/index.html new file mode 100644 index 0000000000..3b0afd6396 --- /dev/null +++ b/files/zh-cn/orphaned/web/api/navigatorplugins/index.html @@ -0,0 +1,106 @@ +--- +title: NavigatorPlugins +slug: orphaned/Web/API/NavigatorPlugins +translation_of: Web/API/NavigatorPlugins +original_slug: Web/API/NavigatorPlugins +--- +<p>{{APIRef("HTML DOM")}}{{SeeCompatTable}}</p> + +<p>The <code><strong>NavigatorPlugins</strong></code> interface contains methods and properties related to the plugins installed in the browser.</p> + +<p>There is no object of type <code>NavigatorPlugins</code>, but other interfaces, like {{domxref("Navigator")}}, implement it.</p> + +<h2 id="Properties">Properties</h2> + +<dl> + <dt>{{domxref("NavigatorPlugins.mimeTypes")}} {{readonlyInline}}{{experimental_inline}}</dt> + <dd>Returns an {{domxref("MimeTypeArray")}} listing the MIME types supported by the browser.</dd> + <dt>{{domxref("NavigatorPlugins.plugins")}} {{readonlyInline}}{{experimental_inline}}</dt> + <dd>Returns a {{domxref("PluginArray")}} listing the plugins installed in the browser.</dd> +</dl> + +<h2 id="Methods">Methods</h2> + +<p><em>The <code>NavigatorPlugins</code></em><em> interface doesn't inherit any method.</em></p> + +<dl> + <dt>{{domxref("NavigatorPlugins.javaEnabled")}} {{readonlyInline}}{{experimental_inline}}</dt> + <dd>Returns a {{domxref("Boolean")}} flag indicating whether the host browser is Java-enabled or not.</dd> +</dl> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', '#navigatorplugins', 'NavigatorPlugins')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The {{domxref("Navigator")}} interface that implements it.</li> +</ul> diff --git a/files/zh-cn/orphaned/web/api/navigatorplugins/javaenabled/index.html b/files/zh-cn/orphaned/web/api/navigatorplugins/javaenabled/index.html new file mode 100644 index 0000000000..746b108c8e --- /dev/null +++ b/files/zh-cn/orphaned/web/api/navigatorplugins/javaenabled/index.html @@ -0,0 +1,31 @@ +--- +title: NavigatorPlugins.javaEnabled +slug: orphaned/Web/API/NavigatorPlugins/javaEnabled +translation_of: Web/API/NavigatorPlugins/javaEnabled +original_slug: Web/API/NavigatorPlugins/javaEnabled +--- +<p>{{ APIRef("HTML DOM") }}</p> + +<h3 id="Summary" name="Summary">概述</h3> + +<p>该方法用来表明当前浏览器是否激活了Java.</p> + +<h3 id="Syntax" name="Syntax">语法</h3> + +<pre class="eval"><em>result</em> = window.navigator.javaEnabled() +</pre> + +<h3 id="Example" name="Example">例子</h3> + +<pre class="eval">if (window.navigator.javaEnabled()) { + // 浏览器中Java可用 +} +</pre> + +<h3 id="Notes" name="Notes">备注</h3> + +<p>该方法的返回值是用来表明浏览器的当前配置文件是否允许使用Java的, 而不是表明浏览器是否支持Java(安装有Java插件).</p> + +<h3 id="Specification" name="Specification">规范</h3> + +<p>{{ DOM0() }}</p> diff --git a/files/zh-cn/orphaned/web/api/navigatorplugins/mimetypes/index.html b/files/zh-cn/orphaned/web/api/navigatorplugins/mimetypes/index.html new file mode 100644 index 0000000000..5b199ae666 --- /dev/null +++ b/files/zh-cn/orphaned/web/api/navigatorplugins/mimetypes/index.html @@ -0,0 +1,40 @@ +--- +title: NavigatorPlugins.mimeTypes +slug: orphaned/Web/API/NavigatorPlugins/mimeTypes +translation_of: Web/API/NavigatorPlugins/mimeTypes +original_slug: Web/API/NavigatorPlugins/mimeTypes +--- +<div>{{ ApiRef("HTML DOM") }}</div> + +<div> </div> + +<h2 id="Summary" name="Summary">概述</h2> + +<p>返回一个{{domxref("MimeTypeArray")}}对象,其中包含可被当前浏览器识别的{{domxref("MimeType")}}对象的列表。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><var>mimeTypes</var> = navigator.mimeTypes; +</pre> + +<p><code>mimeTypes</code> 是一个 <code>MimeTypeArray</code> 对象,其中含有 <code>length</code> 属性、<code>item(index)</code> 和 <code>namedItem(name)</code> 方法。</p> + +<h2 id="Example" name="Example">示例</h2> + +<pre class="brush:js">function isJavaPresent() { + return 'application/x-java-applet' in navigator.mimeTypes; +} + +function getJavaPluginDescription() { + var mimetype = navigator.mimeTypes['application/x-java-applet']; + if (mimetype === undefined) { + // no Java plugin present + return undefined; + } + return mimetype.enabledPlugin.description; +} +</pre> + +<h2 id="Specification" name="Specification">Specification</h2> + +<p><em>mimeTypes 并未包含在任何规范中。</em></p> diff --git a/files/zh-cn/orphaned/web/api/navigatorplugins/plugins/index.html b/files/zh-cn/orphaned/web/api/navigatorplugins/plugins/index.html new file mode 100644 index 0000000000..a93bb6741c --- /dev/null +++ b/files/zh-cn/orphaned/web/api/navigatorplugins/plugins/index.html @@ -0,0 +1,96 @@ +--- +title: NavigatorPlugins.plugins +slug: orphaned/Web/API/NavigatorPlugins/plugins +tags: + - API + - DOM + - Navigator + - NavigatorPlugins + - Reference +translation_of: Web/API/NavigatorPlugins/plugins +original_slug: Web/API/NavigatorPlugins/plugins +--- +<p>{{APIRef("HTML DOM")}}</p> + +<p>返回一个 {{ domxref("PluginArray") }} 类型的对象, 包含了当前所使用的浏览器安装的所有插件。</p> + +<div class="blockIndicator note"> +<p>在Firefox 29及之后的版本,出于隐私考虑,<code>navigator.plugins</code> 数组的枚举可能会被限制。如果一定要检查是否存在某个浏览器插件,应该用准确的插件名字查询 <code>navigator.plugins</code> 或 {{DOMxRef("navigator.mimeTypes")}} ,而不是枚举 <code>navigator.plugins</code> 数组,再对比每个插件的名字。 这项有关隐私的改变不会禁用任何插件,只是将插件名字从枚举中隐藏了而已。</p> +</div> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="eval"><em>plugins</em> = navigator.plugins; +</pre> + +<p><code>plugins</code> 是一个 {{DOMxRef("PluginArray")}} 对象,通过名字或项目列表获取 {{DOMxRef("Plugin")}} 对象。</p> + +<p>返回值不是一个普通的JavaScript数组,但是它也有 <code>length</code> 属性,也可以使用<code>plugins</code>[<code><em>index</em></code>]来获取到每个元素的值, 例如(<code>plugins{{ mediawiki.external("2") }}</code>), 效果和使用 <code>item(<em>index</em>)</code> 以及 <code>namedItem(<em>"name"</em>)</code> 是一样的.</p> + +<h2 id="Example" name="Example">示例</h2> + +<p>下述示例中的函数返回Shockwave Flash插件的版本。</p> + +<pre>function getFlashVersion() { + var flash = navigator.plugins.namedItem('Shockwave Flash'); + if (typeof flash != 'object') { + // flash is not present + return undefined; + } + if(flash.version){ + return flash.version; + } else { + //No version property (e.g. in Chrome) + return flash.description.replace(/Shockwave Flash /,""); + } +} +</pre> + +<p>下述示例可显示已安装插件的信息。</p> + +<pre>var pluginsLength = navigator.plugins.length; + +document.body.innerHTML = pluginsLength + " Plugin(s)<br>" + + '<table id="pluginTable"><thead>' + +'<tr><th>Name</th><th>Filename</th><th>description</th><th>version</th></tr>' + +'</thead><tbody></tbody></table>'; + +var table = document.getElementById('pluginTable'); + +for(var i = 0; i < pluginsLength; i++) { + let newRow = table.insertRow(); + newRow.insertCell().textContent = navigator.plugins[i].name; + newRow.insertCell().textContent = navigator.plugins[i].filename; + newRow.insertCell().textContent = navigator.plugins[i].description; + newRow.insertCell().textContent = navigator.plugins[i].version?navigator.plugins[i].version:""; +} +</pre> + +<h2 id="Notes" name="Notes">备注</h2> + +<p>{{DOMxRef("Plugin")}}对象提供一个小型接口,用于获取浏览器中安装的各种插件的信息。你也可以进入 <code>about:plugins</code> 页面,来查看浏览器上安装的插件(Chrome已移除该入口)。</p> + +<h2 id="规范">规范</h2> + +<table> + <thead> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">注释</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-navigator-plugins', 'NavigatorPlugins.plugins')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{Compat("api.NavigatorPlugins.plugins")}}</p> + +<p>In addition to listing each plugin as a pseudo-array by zero-indexed numeric properties, Firefox provides properties that are the plugin name directly on the <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/API/PluginArray">PluginArray</a> object.</p> |