jeff
jeff

Reputation: 13653

Why is Chrome Extension JavaScript does not get changed?

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..

Upvotes: 1

Views: 138

Answers (1)

Timothée Boucher
Timothée Boucher

Reputation: 1565

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)

Upvotes: 3

Related Questions