How do I disable offline caching?

0 favourites
  • 7 posts
  • Is there a way to prevent caching so it must download every time when playing in a browser? I saw someone ask this question before, but they didn't get an answer.

    I ask because I'm currently working on a prototype that I frequently share with others to get feedback. More than once we've updated it and then been confused when the changes we just uploaded are not visible. I now know that what was really going on is it was downloading the newer version in the background while displaying the older version, but during this prototyping phase I think it would be simpler for everybody concerned to just have it reload it every time; that way we KNOW that it's the latest version and don't have to explain to each new tester that they have to run it, wait a while for the update to download, then run it again.

    Offline mode is a nice feature and I wouldn't disable it in the final version, but during this prototyping phase when we're cranking out new versions on a daily basis, it would be handy to be able to turn it off. Is it possible?

  • Yes, you need append a parameter/string to the file name in the c2runtime.js script tag and change it when your file changes.

    Locate this text in the "index.html" file

    <script src="c2runtime.js"></script>

    And change to something like this

    <script src="c2runtime.js?version=1.0"></script>

    The browser interprets the whole string as the file path even though what comes after the "?" are parameters. So next time you update your file just change the number in the script tag on your website

    Example

    <script src="c2runtime.js?version=1.1"></script>

    This will trick the browser into thinking it s new file and not used the cached file.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, you need append a parameter/string to the file name in the c2runtime.js script tag and change it when your file changes.

    That didn't work for me. I uploaded a new version and appended the parameter like your example showed, but when I ran it it still showed the old version while downloading the new version.

  • I suppose one way around it would be to use the Browser object's "Is downloading update" condition to send the user to a layout that resembled a sort of "loading screen" while it updates itself. That would probably help avoid confusion.

  • It didn't work? Really... I use this method (even in my commercial projects) and it works... granted I just mash the keyboard (or have PHP generate it) and generate a longer string but the concept is still the same.

    This is what mine usually looks like <script src="c2runtime.js?version=euwkjfskdfskddfsdfwrfsdnf"></script>

    I can say from experience (As a web developer) that this is how its done. Try it with a longer random string name. It should work..

  • you could also delete the offline.appcache, I think that will work fine (since this is teh file that caches everything)

  • The offline.appcache has been one of my greatest pet peeves with Construct 2. I too have to upload updated material constantly and I always run into the problem of having the older version of my upload being shown instead of the most recent upload. Sometimes this process takes up hours and days of my time. I have suggested having the offline.appcache function as an option during export. I personally never really need it until my final export, when everything has been tested. But I guess not enough people have a problem with this feature to have it changed.

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