Detecting NPAPI support using JavaScript

2024/2/27 8:27:35

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.

Answer

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.

http://en.ppmy.cn/q/42227.html

Related Q&A

Object tag loads SVG but its Content Document is null

Issue Summary: I have successfully loaded an SVG onto my page using the <object> tag but I am still unable to access its inner elements with javascript. It doesnt seem to be a CORS issue since th…

Location reload in Jasmine

Im really not sure how to approach testing this? (spyOn?)function reloadPage() {$(#logo).click(function() {location.reload();}) }Any advice would be great!

How to save a variable to Android using Cocos2D-JS?

I am trying to save a high score integer to the users Android system, so that it can persist throughout all game-play experience.I have read that using Cocos2D-X one can use NSUserDefaults but this doe…

Is there a way to override the browsers default behavior for clicking on hashes?

When I have the following:<a name=test></a>...and load it in a browser, I can append #test to the URL and the browser will scroll so that the <a> is at the top of the page.However, I …

How to stop iframe loading?

Hi Im uploading a file through an iframe.HTML:<from action="upload.php" target="iframe"><input type="file" name="file" /><input type="submit&…

Difference between window (browser) and global (Node.js) objects

I am trying to understand how Javascript works under the hood so Ive been playing around a bit. For example, the following code generates different outputs when in Chromes console or when in Node.js:va…

How do I get the clicked element with inline HTML onclick and jQuery?

Im creating a tags with this code:$(#td + id).append(<p><a href="#" onclick="excluirArquivo(\ + response + \); return false;"><img src="/erp/proposta/media/image…

Does curry function in javascript uses principle of closure? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Update the question so it focuses on one problem only by editing this post.Closed 7…

The execution sequence when returning a Promise object in promise then mehod [duplicate]

This question already has answers here:What is the difference between returned Promise?(2 answers)ES6 promise execution order for returned values(2 answers)What is the order of execution in JavaScript…

Using sequelize cli with typescript

Im trying to use sequelize with typescript, but dont know how. I installed a package named sequelize-cli-typescript, but it does not work with sequelize v6. And I know it is better to use migrations to…