0

I have browser plugin built using NPAPI Lib for Safari and firefox for Mac System.Now I have newer version plugin and I am asking user to download new plugin if user doesn't have latest plugin.

after downloading the plugin it is not getting loaded and I have to close the browser and restart it.

I am doing navigator.plugin.refresh(false) at regular interval but no success.I can't reload the page at this moment because I am still getting old plugin version.

If go and kill the plugin in activity monitor and restart the browser it is showing new plugin version. Please help me on this.

Edited:

This method is called every 3 sec

function InitIEPlugin() {
plugin = navigator.plugins["MyPlug-In"];
        if (plugin) {
            remoteEngine = document.getElementById('MyPlugin');
            if (remoteEngine) {
                isMyPluginInstalled = true;
                var version = remoteEngine.getAttributeByKey("plugin_version");
                if ((ua.indexOf('Intel Mac OS X 10.5') >= 0) || (ua.indexOf('Intel Mac OS X 10_5') >= 0)) {
                    //isHarmonyPluginUpgradeRequired = CheckVersionOfPlugin(version);
                }
                else {
                    isMyPluginUpgradeRequired = CheckVersionOfMacPlugin(version);
                    if (isMyPluginUpgradeRequired == true)
                        isMyPluginInstalled = false;
                }
            }
        }
   }
Vikram Ranabhatt
  • 7,268
  • 15
  • 70
  • 133

1 Answers1

1

Next time make sure you mention your OS in the text; I see you're on OS X from your tags, but it changes everything to know that you're on Mac.

You need to install the new version as a different filename (well, the .plugin/ bundle needs to be named differently). The easiest way to do this is just to put the version of the plugin in the filename, e.g. ~/Library/Internet\ Plug-Ins/MyPlugin_1.1.0.12.plugin

As long as the new plugin has a different filename than the old, it should work.

taxilian
  • 14,229
  • 4
  • 34
  • 73
  • But in this both older and new plugin will be in the process.So we need to change webPluginName and WebPluginMIMETypes as well.Please confirm! – Vikram Ranabhatt Aug 19 '13 at 07:18
  • As long as you change the filename you should be good; no reason you'd need to change the mimetypes or anything (I've never needed to) – taxilian Aug 19 '13 at 14:18
  • But var version = remoteEngine.getAttributeByKey("plugin_version") always give me older version here. – Vikram Ranabhatt Aug 19 '13 at 14:44
  • The problem I am facing is old plugins remains in the memory and when I make method call in plugin it will call he older one not the new one. – Vikram Ranabhatt Aug 20 '13 at 09:44
  • You need to remove the old object/embed tag from the DOM and release any references to it so it can be garbage collected and then insert a new object/embed tag. Until you release it, it won't unload. Even then you have no guarantee of when it will be unloaded by the browser, but there isn't anything you can do about that. – taxilian Aug 20 '13 at 17:33
  • :I have one question When You update your plugin than there will be two different version plugins in you /Library/Internet Plugins folder.So when you refresh there will be two plugins in the array.Now my point is how your differentiate between these two plugin and make a function call to them. – Vikram Ranabhatt Aug 21 '13 at 13:17
  • Only one of them, the new one, will be instantiated, so you can't make a function call to the old one. Personally I use the filename to determine that the version I'm looking for is installed – taxilian Aug 21 '13 at 16:31