I have browser plugin for Safari/Firefox on Mac.When user launch webpage it will ask user to download the plugin.Ideally it should refresh the page automatically when download is done and make use of plugin.
The code is able to detect the plugin but when I call method in plugin it is throwing exception. If I manually refresh the page and call the plugin method I am able to do it.
InitPlugin()
{
var IsPluginInstalled;
var plugin = navigator.plugins["My Plug-In"]; // success
var engine;
if (plugin)
{
engine = plugin.getElementById("MyPlugin");
var version = engine.getAttributeByKey("my_plugin_version"); // crashing here.
IsPluginInstalled = true;
}
}
RefreshPlugin()
{
navigator.plugins.refresh();
if (!InitPlugin())
{
setInterval(InitPlugin,3000);
}
}
after install page should refresh automatically This is code is working fine if refresh the page manually.