How do I remove a JSON from browser cache

0 favourites
  • 3 posts
From the Asset Store
This is a single chapter from the Construct Starter Kit Collection and the Student Workbook from the Workshop.
  • My game loads a JSON data file from the web directory I've uploaded it too. I'm trying to update the JSON file on the fly, but it appears to be cached in the browser so even after I've uploaded the new file, the online game will continue using the old version of the file stored in the browsers memory (unless I refresh several times, or clear the browser cache manually).

    I've deleted the JSON file from the offline.appcache file that's created once the game is exported, but it still doesn't seem to work.

    Does anyone know how to automatically re-download a JSON file every time (or possibly detect when changes have been made and only re-download it then)? The game depends on this file being up to date.

    Thanks in advance.

  • I'm sure someone can provide a more detailed response but the quick fix might be to use the Browser object to Reload the page at some point after you've modified the JSON data.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you're using ajax to get the file you could try this:

    http://stackoverflow.com/questions/2235 ... -f5-reload

    aka: setRequestHeader('Cache-Control', 'no-cache') before requesting the file. Also the second idea in that link is interesting. I don't have anything to test this with.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)