Avoiding reloading of Google Chrome extension

左心房为你撑大大i 提交于 2019-12-21 04:33:15

问题


I am developing Google Chrome extension. Each time my JavaScript source changes, I find myself having to click "load unpacked extension" again to have the changes take effect.

Reloading the extension at each iteration is very tedious. Can it be avoided?


回答1:


Depends on the asset, lets review:


Asset ----------------------------------------- Action needed

popup.html HTML -------------------------- Refresh browser page

popup.html JS ------------------------------- Refresh browser page

contentscript via manifest ----------------- Reload extension

contentscript via executeScript (code) - location.reload(true) on background page

contentscript via executeScript (file) ---- Refresh browser page

background.html HTML ------------------- location.reload(true) on background page

background.html JS ------------------------ location.reload(true) on background page


For more information on how to do the location.reload(true) see the page on debugging

The content script requiring a plugin reload has been brought up recently and acknowledged by the chromium team:

http://code.google.com/p/chromium/issues/detail?id=104610

Consider using programmatic injection (contentscript via executeScript (file)) to avoid having to reload the plugin for content script updates.



来源:https://stackoverflow.com/questions/9057362/avoiding-reloading-of-google-chrome-extension

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