Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!