I have NPAPI plugin for Mac Safari/fire Fox browser.The plugins has several method and I can call it from java script.I wanted to know whether I can close or unload the plugin through implementing method inside it.I need this function to unload the plugin from browser/memory.
1 Answers
Short answer: No.
Longer answer: not really. What you can do is remove the object tag from the DOM, which will cause that instance to be unloaded. It makes no guarantees that the browser will unload the module, but it does at least get the instance out of your way.
Most people who want to do that are trying to find a way to update the plugin without closing the browser; you can do this, but you need to install the new plugin with a different filename than the old plugin. I'm talking about the filename of the .plugin/ bundle, not the binary inside it.
If you have a plugin in ~/Internet Plugins/MyPlugin-1.0.0.0
and you delete that and put a new plugin in ~/Internet Plugins/MyPlugin-1.0.0.1
and then in javascript you call navigator.plugins.refresh(false);
the browser will find the new plugin and when you instantiate it it'll give you the new version. The bundle has to be named differently, though; that's the key.

- 14,229
- 4
- 34
- 73
-
you can't expect user to delete the plugins from the folder.Think about larger perspective if the plugin i used in a website and lot user are using it. – Vikram Ranabhatt Sep 06 '13 at 05:59
-
Why would the user need to delete the plugins from the folder? I didn't say you need to leave the old one in place, just that the new one needs to have a different name or the browser will not detect it. On Mac OS you can absolutely delete the old plugin while it is still in use -- as soon as it's not in use anymore it will be actually deleted, but in the mean time it will appear deleted to everyone that isn't already accessing it. – taxilian Sep 06 '13 at 14:59