Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoiding reloading of Google Chrome extension

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?

like image 687
Randomblue Avatar asked Jan 29 '12 22:01

Randomblue


People also ask

How do I stop Chrome from automatically refreshing extensions?

Go to chrome web store. Type Stop AutoRefresh into the search box at top left. Press Enter and look at the auto refresh blocker extension displayed in the right-hand pane. Click on the Add to Chrome button.

How do I turn off auto refresh?

Click the Start button, type “internet options” and select Internet Options in the search results. In the Internet Properties window, click “Custom tab -> Custom level,” then in the Security Settings window, scroll down until you find “Allow META REFRESH.” Disable this option and click OK.

Why does Google Chrome keep refreshing itself?

By default, if it's using a lot of memory, Chrome purges the contents of some background tabs from RAM to conserve system resources. When you click back onto those tabs, the browser has to reload them because they have been erased from memory.


1 Answers

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.

like image 104
Adam Ayres Avatar answered Sep 28 '22 19:09

Adam Ayres