1

I'm trying to build a chrome extension, based on this one

so I have two files: manifest.json and sample.js

I make some changes on sample.js, they sometimes apply when I reload the page, sometimes don't. I try clearing the cache. Again, it sometimes work. Now I'm completely stuck.

Let's say I try to alert something when clicked on a context menu,

function onClickHandler(info, tab) {
 alert("1");
}

then I change it to

function onClickHandler(info, tab) {
 alert("2");
}

but it keeps alerting 1.

I try clearing the cache, closing and re opening Chrome, even uninstalling and re-installing the extension. Nothing works.

I hope I made myself clear. How do I make sure that the extension is up to date with my sample.js file?

Do I need to disable javascript cache somewhere ?

Thanks for any help..

jeff
  • 13,055
  • 29
  • 78
  • 136
  • possible duplicate of [Faster way to modify chrome extension than Remove -> Load unpacked](http://stackoverflow.com/questions/8159273/faster-way-to-modify-chrome-extension-than-remove-load-unpacked) – Evan Carroll Feb 23 '14 at 23:41

1 Answers1

3

You should go to chrome://extensions/ and click "Reload" for your extension. (or press Ctrl/Cmd+R but that will reload all your development extensions which might take longer if you have a bunch)

It's the best way to make sure all your extension files are reloaded.

Another way is to use something like Extensions Reloader. It's an extension that adds a button to your toolbar which will reload your extensions for you. (except for changes to manifest.json, which shouldn't be a problem since that's not the file you'll change the most)

Timothée Boucher
  • 1,535
  • 12
  • 30
  • Manually reloading is ok, I only have one. I just need a 100% sure way to have the latest code running. I will give that extension a try, if reload does not work. Thanks ! – jeff Aug 16 '13 at 05:21
  • In that case, going to chrome://extensions/ is the way to go. – Timothée Boucher Aug 16 '13 at 05:25
  • Yep, it worked. I will accept your answer in 2 minutes. Thanks again ! – jeff Aug 16 '13 at 05:28
  • Note that the Reload button (circle arrow icon) is only visible, when there are no errors. (The Error Button appears next to the Remove Button.) Also, you need to press "clear errors" after reloading; they don't clear automatically. – Protector one Sep 16 '20 at 21:35