如果安装了插件,如何检查Firefox和Chrome [英] How do I check in Firefox and Chrome if a plugin is installed

查看:182
本文介绍了如果安装了插件,如何检查Firefox和Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的web应用中使用嵌入式插件来启用扫描(Dynamsoft的webscanning插件)。我正在为Firefox用户和Chrome用户提供一个xpi服务。在没有安装插件的情况下查看页面时,Firefox会尝试下载插件,用户需要点击手动安装进行安装。 Chrome将不会尝试下载插件(这是通过设计,根据 http://code.google.com/p/chromium/issues/detail?id=15745



我想用javascript来检测该插件是否安装(最好在尝试通过嵌入标签加载之前)。如果没有安装插件,我想提供一个解释和链接到正确的插件给用户。如果用户点击下载链接,而不是尝试通过嵌入标签加载,那么两个浏览器都可以安装各自的插件。

所以,有没有人知道一个方法检测插件是否安装使用javascript?

解决方案

你有看看 window.navigator.plugins



。 。和webkit的等效参考 plugins -



WebKit DOM的Apple参考似乎已经消失。 navigator.plugins 在Safari&铬。在这里看到一个jsfiddle: http://jsfiddle.net/2EaKD/


I'm using an embedded plugin in my web app to enable scanning (Dynamsoft's webscanning plugin). I'm serving an xpi to firefox users and a crx to chrome users. When viewing the page without the plugin installed, Firefox will try to download the plugin and the user will need to click "manual install" to install it. Chrome will make no attempt to donwload the plugin (this is by design, according to http://code.google.com/p/chromium/issues/detail?id=15745)

I would like to use javascript to detect wether the plugin is installed or not (preferrably before trying to load it through the embed tag). If no plugin is installed, I want to provide an explanation and a link to the correct plugin to the user. Both browsers install their respective plugins without any problem if the user clicks at a download link instead of just trying to load through the embed tag.

So, does anybody know a way detect wether a plugin is installed using javascript?

解决方案

Have you had a look at window.navigator.plugins?

..and the equivalent reference for webkit plugins-

The Apple reference for the WebKit DOM appears to have disappeared. navigator.plugins does work for me in Safari & Chrome. See a jsfiddle here: http://jsfiddle.net/2EaKD/

这篇关于如果安装了插件,如何检查Firefox和Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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