How do I disable offline caching?

Get help using Construct 2

Post » Thu Jul 24, 2014 5:15 pm

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?
B
6
S
1
Posts: 38
Reputation: 683

Post » Thu Jul 24, 2014 5:58 pm

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.
B
20
S
7
G
1
Posts: 221
Reputation: 2,077

Post » Thu Jul 24, 2014 6:43 pm

troublesum wrote: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.
B
6
S
1
Posts: 38
Reputation: 683

Post » Thu Jul 24, 2014 6:46 pm

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.
B
6
S
1
Posts: 38
Reputation: 683

Post » Thu Jul 24, 2014 7:09 pm

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..
B
20
S
7
G
1
Posts: 221
Reputation: 2,077

Post » Thu Jul 24, 2014 7:13 pm

you could also delete the offline.appcache, I think that will work fine (since this is teh file that caches everything)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Aug 17, 2014 3:49 pm

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.
B
15
S
2
Posts: 27
Reputation: 1,229


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 28 guests