Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

163
Visualizações
How to clear cache for a Chrome extension's background process?

I see several questions about clearing cache in Chrome in general, but this is specific to my extension which uses a background script. I have an extension which retrieves Json data from a background script:

//In the content script
chrome.runtime.sendMessage({ query: 'getList' }, function (result) {
    //Uses list data
});

Inside the background js file, I'm retrieve data from a JQuery ajax call:

//In a background script
chrome.runtime.onMessage.addListener(
    function (request, sender, sendResponse) {
        $.get('http://example.com/data.txt', function (result) {
            sendResponse(result);
        });
});

I have updated the context of the data.txt file on my server. However, the Chrome extension continues to use the old data. I have the same exact code running in a Firefox add-on, and in Firefox I see the new data immediately when updating the .txt file.

I don't know how to tell whether the actual issue is that the sendMessage() call is just using a cached value instead of going to my background script, or whether my background script is just returning a cached value instead of retrieving the update from my server.

I updated the .txt file over a day ago, so it's not just a short-term caching issue. What can I do to force the Chrome extension itself to refresh the data coming from the background script? It does not appear to be a local issue; even uninstalling and re-installing the script doesn't fix the issue; it's not that it's being cached in my local Chrome cache.

If I visit http://example.com/data.txt in Chrome (or any browser), I see the updated file.

I'm guessing that if I deployed a new package to the Chrome Developer Dashboard, then it would clear. But the whole reason I have this background script and JQuery call is so that I can easily update this data without having to re-deploy the extension whenever it changes.

Is there anything that can be done from the Chrome Developer Dashboard to force it to refresh?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda