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

159
Visualizações
How to clear local cache of a client when i update my website?

I want to clear the cache of all the clients who have already played my game, the stats of the game are stored in local storage, and some of my clients played the game when the stats were buggy and that data would now effect the updated stats of my game, whats the easiest way to clear the clients cache so everyone starts from scratch, i have tried to add '?v=2' this to the end of java script and CSS files but had no luck.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

In general, I'd suggest to include a version number in the storage data. Eg

{
  "version": 5,
  "settings": {
    ...

When you make an update to your game's JavaScript, also associate the newly updated JS with an incremented version number by putting it in the JS.

const currentVersion = 6;

Then, in the JS, you can parse the local storage data. If the version in storage is less than the current version, you can

  • Completely discard the data in storage and start anew, or
  • With the knowledge of what the storage schema used to be, transform it into the new schema. (This would probably be a lot more user-friendly if it wouldn't create balancing issues, and you have the time to code the transformation.)

Since you probably don't have a version property in storage yet, you can start out by checking to see if the property exists or not yet, and if it doesn't, then you need to update.

about 4 years ago · Juan Pablo Isaza Relatório

0

If you use the localstorage then you can reset your data in the localstorage. I would store a versionnumber into the storage. Then you check on every request if the version is change. If yes your set the localstorage to null etc. and save the new values.

about 4 years ago · Juan Pablo Isaza Relatório
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