From 235c34993c7b14f783fc8259cc237ac09f0d3e57 Mon Sep 17 00:00:00 2001 From: MDN Date: Fri, 9 Jul 2021 00:38:08 +0000 Subject: [CRON] sync translated content --- .../orphaned/web/api/navigatorplugins/index.html | 106 +++++++++++++++++++++ .../api/navigatorplugins/javaenabled/index.html | 31 ++++++ .../web/api/navigatorplugins/mimetypes/index.html | 40 ++++++++ .../web/api/navigatorplugins/plugins/index.html | 96 +++++++++++++++++++ 4 files changed, 273 insertions(+) create mode 100644 files/zh-cn/orphaned/web/api/navigatorplugins/index.html create mode 100644 files/zh-cn/orphaned/web/api/navigatorplugins/javaenabled/index.html create mode 100644 files/zh-cn/orphaned/web/api/navigatorplugins/mimetypes/index.html create mode 100644 files/zh-cn/orphaned/web/api/navigatorplugins/plugins/index.html (limited to 'files/zh-cn/orphaned/web/api/navigatorplugins') 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 +--- +

{{APIRef("HTML DOM")}}{{SeeCompatTable}}

+ +

The NavigatorPlugins interface contains methods and properties related to the plugins installed in the browser.

+ +

There is no object of type NavigatorPlugins, but other interfaces, like {{domxref("Navigator")}}, implement it.

+ +

Properties

+ +
+
{{domxref("NavigatorPlugins.mimeTypes")}} {{readonlyInline}}{{experimental_inline}}
+
Returns an {{domxref("MimeTypeArray")}} listing the MIME types supported by the browser.
+
{{domxref("NavigatorPlugins.plugins")}} {{readonlyInline}}{{experimental_inline}}
+
Returns a {{domxref("PluginArray")}} listing the plugins installed in the browser.
+
+ +

Methods

+ +

The NavigatorPlugins interface doesn't inherit any method.

+ +
+
{{domxref("NavigatorPlugins.javaEnabled")}} {{readonlyInline}}{{experimental_inline}}
+
Returns a {{domxref("Boolean")}} flag indicating whether the host browser is Java-enabled or not.
+
+ +

Specifications

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', '#navigatorplugins', 'NavigatorPlugins')}}{{Spec2('HTML WHATWG')}}Initial definition.
+ +

Browser compatibility

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

See also

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

{{ APIRef("HTML DOM") }}

+ +

概述

+ +

该方法用来表明当前浏览器是否激活了Java.

+ +

语法

+ +
result = window.navigator.javaEnabled()
+
+ +

例子

+ +
if (window.navigator.javaEnabled()) {
+   // 浏览器中Java可用
+}
+
+ +

备注

+ +

该方法的返回值是用来表明浏览器的当前配置文件是否允许使用Java的, 而不是表明浏览器是否支持Java(安装有Java插件).

+ +

规范

+ +

{{ DOM0() }}

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 +--- +
{{ ApiRef("HTML DOM") }}
+ +
 
+ +

概述

+ +

返回一个{{domxref("MimeTypeArray")}}对象,其中包含可被当前浏览器识别的{{domxref("MimeType")}}对象的列表。

+ +

语法

+ +
mimeTypes = navigator.mimeTypes;
+
+ +

mimeTypes 是一个 MimeTypeArray 对象,其中含有 length 属性、item(index) 和 namedItem(name) 方法。

+ +

示例

+ +
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;
+}
+
+ +

Specification

+ +

mimeTypes 并未包含在任何规范中。

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

{{APIRef("HTML DOM")}}

+ +

返回一个 {{ domxref("PluginArray") }} 类型的对象, 包含了当前所使用的浏览器安装的所有插件。

+ +
+

在Firefox 29及之后的版本,出于隐私考虑,navigator.plugins 数组的枚举可能会被限制。如果一定要检查是否存在某个浏览器插件,应该用准确的插件名字查询 navigator.plugins  或 {{DOMxRef("navigator.mimeTypes")}} ,而不是枚举 navigator.plugins  数组,再对比每个插件的名字。 这项有关隐私的改变不会禁用任何插件,只是将插件名字从枚举中隐藏了而已。

+
+ +

语法

+ +
plugins = navigator.plugins;
+
+ +

plugins 是一个 {{DOMxRef("PluginArray")}} 对象,通过名字或项目列表获取 {{DOMxRef("Plugin")}} 对象。

+ +

返回值不是一个普通的JavaScript数组,但是它也有 length 属性,也可以使用plugins[index]来获取到每个元素的值, 例如(plugins{{ mediawiki.external("2") }}), 效果和使用 item(index) 以及 namedItem("name") 是一样的.

+ +

示例

+ +

下述示例中的函数返回Shockwave Flash插件的版本。

+ +
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 /,"");
+  }
+}
+
+ +

下述示例可显示已安装插件的信息。

+ +
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:"";
+}
+
+ +

备注

+ +

{{DOMxRef("Plugin")}}对象提供一个小型接口,用于获取浏览器中安装的各种插件的信息。你也可以进入 about:plugins 页面,来查看浏览器上安装的插件(Chrome已移除该入口)。

+ +

规范

+ + + + + + + + + + + + + + + + +
规范状态注释
{{SpecName('HTML WHATWG', '#dom-navigator-plugins', 'NavigatorPlugins.plugins')}}{{Spec2('HTML WHATWG')}}Initial definition.
+ +

浏览器兼容性

+ +

{{Compat("api.NavigatorPlugins.plugins")}}

+ +

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 PluginArray object.

-- cgit v1.2.3-54-g00ecf