是否可以通过JavaScript检测插件是否被激活? [英] Is it possible to detect if a plugin is activated or not through JavaScript?

查看:142
本文介绍了是否可以通过JavaScript检测插件是否被激活?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样我通常会检测插件,例如 Flash Player

This way I would normally detect plugins, such as Flash Player:

for (var el in navigator.plugins) {
    if (navigator.plugins[el].name &&
        navigator.plugins[el].name.toLowerCase().indexOf('shockwave') !== -1) {
        console.log(navigator.plugins[el]);
    }
}

我不是在寻找跨浏览器解决方案或者想要测试它是否正确。测试此插件是否处于活动状态的方法是什么?

I'm not looking for a cross-browser solution or want to test if it is the right way or not. What is the way to test if this plugin is active or not?

推荐答案

其他两个解决方案都可以找出是否存在插件已安装并已启用。

Both of the other solutions work to find out if a plugin is installed AND is enabled.

目前无法确定插件是否已安装但已被禁用。 Navigator.plugins 不包含仍然安装的已禁用插件。

There is currently no way to find out if the plugin is installed but is disabled. Navigator.plugins does not contain disabled plugins which are still installed.

这篇关于是否可以通过JavaScript检测插件是否被激活?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆