如何以编程方式了解Chrome是否支持NPAPI

时间:2015-01-20 12:05:01

标签: javascript google-chrome npapi ppapi

正如您在Chromium project所看到的,Chrome / Chromium很快就不会支持NPAPI。所以你可以开发基于PPAPI的解决方案,好的。

我开发了一个使用NPAPI插件的门户网站。每次加载门户网站(并且可能更新了chrome)时,我需要知道客户端浏览器是否保持兼容(即支持NPAPI)。

换句话说,我会这样:

// sub-methods
function isTheBrowserNpapiCapable() {
    // something I am searching
}

function displayTheNewPortal() {
    // install the PPAPI plugin if not present
    // do something ...
}

function displayTheRegularPortal() {
    // install the NPAPI plugin if not present
    // do something ...
}

// main code
if(isTheBrowserNpapiCapable()) {
    console.log("The browser stays compatible with the regular NPAPI plugin!");
    displayTheRegularPortal();

} else {
    console.log("Got it! NPAPI is definitively discarded. User must install the new PPAPI plugin");
    displayTheNewPortal();
}

我找到了"detect if chrome user has NPAPI active""NPAPI not loaded in Chrome""detecting NPAPI using Javascript",但它对我没有帮助。我不知道我的插件是否已安装,但是安装的插件是什么(NPAPI或PPAPI)。

有人有想法帮助我吗?

此致

0 个答案:

没有答案