Detecting NPAPI support using JavaScript

2019-02-18 04:05发布

How can you detect if a browser supports NPAPI from JavaScript? Not all of them do, and whilst I could rely on the user-agent I'd much rather do it a more reliable way if one exists.

Unfortunately, I can't simply detect if my plug-in has loaded or not, as it may be that the plugin simply isn't installed yet on a supported browser.

Thanks.

2条回答
乱世女痞
2楼-- · 2019-02-18 04:16

If you want to check whether java plugins are enabled or not in the browser then you should use the navigator.javaEnabled(). It will work in chrome.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-02-18 04:19

There is no JS API for this, but basically all desktop browsers except IE-/Trident-based ones and ChromeOS support NPAPI.

You can find out wether your plugin is installed by checking navigator.plugins.

查看更多
登录 后发表回答