firebreath plugin refresh after update

淺唱寂寞╮ 提交于 2020-01-06 07:23:05

问题


I want to reload a plugin after update without restarting browser. I tried the mac version, it works fine, howeve, I need to change the plugin name for each version.

navigator.plugins.refresh(false);

http://www.firebreath.org/display/documentation/Deploying+and+updating+your+plugin?focusedCommentId=8585308#comment-8585308

In windows, I tried those steps and I couldn't make it work. Has anyone had any luck with this? Does anyone know what could be wrong?

"On Windows you even need to install it to a version-specific directory with a version-specific filename. Once the plugin is installed, you can try the following to reload the plugin in open browsers

<script>
    var myplugin = "<object id=\"plugin\" type=\"application/x-foobar\"> </object>";
    function onload(){ // Assuming this function put your plugin on the page in the first place
        document.getElementById('pluginHere').innerHTML = myplugin;
    }
    function reload(){
        document.getElementById('pluginHere').innerHTML = "";
        document.getElementById('pluginHere').innerHTML = myplugin;
    }
</script>

thanks alot.


回答1:


This is a difficult trick that can go wrong in a lot of different ways. It's difficult for me to guess what might be going wrong specifically, particularly since you said "on windows", but you haven't specified what browser that is. All of the browsers work differently in subtle ways and IE and the others are completely different as far as this goes.

Things you could try:

  • use setTimeout to add a small delay between removing the plugin from the DOM and re-adding it
  • open about:plugins and then shift-refresh to see if it picks up the new version
  • Try different browsers and see what the behavior is
  • Use Process Monitor to monitor the queries of the registry and see when the registry keys are being accessed; use this to help plan your strategy.

Anyway, I hope some of that helps; I used to upgrade that way but it was too error prone and too prone to things changing with new browsers, so these days I just make the client restart their browser on upgrades. It saves a lot of hassle and lots of development time.




回答2:


I use a signed CAB with MSI inside to load the plugin on internet explorer. On the first time install I found that the plugin can be accessed from Javascript but events were not working. When I looked at loaded plugins, the plugin was not loaded. If I refreshed the page the plugin is loaded. my solution was to add the following code from this stack overflow question One time page refresh after first page load This worked like a charm.



来源:https://stackoverflow.com/questions/11992066/firebreath-plugin-refresh-after-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!