问题
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