Cache

Monkey Targets Forums/HTML5/Cache

David Casual Box(Posted 2013) [#1]
We have a lot of issues to deploy a commercial online game with HTML5/Monkey because of the cache.

When we update the app, the player browsers are still loading some old assets/js from their cache, raising errors.

Is there a way to detect there is an update and kill the cache?


David Casual Box(Posted 2013) [#2]
We tried to add:

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

With no success!


therevills(Posted 2013) [#3]
Try appending a dummy version number on the javascript file.
For example:
<script language="javascript" src="main.js?v=1">Javascript not supported!</script>



David Casual Box(Posted 2013) [#4]
Thanks thereviils. I'm not sure to understand what this will do to the cache?
According to our errors, it's mostly "error loading image...." meaning that albeit the js is updated, it cannot continue to read old images until we clear the cache.


AdamRedwoods(Posted 2013) [#5]
i wonder if a folder versioning would work?
data/
  images/
     v1/myimages.png
     v2/myimages.png

you would delete the v1 image folder when deploying to the server for v2.

what threvills mentioned may work, as it may invalidate the images, too.
in pure HTML5, you would be able to add "myimage.png?r=201306070" timestamp at the end, and this would work, BUT MONKEY CURRENTLY DOES NOT ALLOW THIS. I'll post it as a feature request, as this would be good idea to allow this.


therevills(Posted 2013) [#6]
By adding the dummy version number it should force the client to reload the javascript.

But if you are getting "error loading image" that's totally different. Maybe have a version folder for your entire game and update the HTML to point to the new version each time.


David Casual Box(Posted 2013) [#7]
will try today with a sub directory in data (because the issue occur with the sounds too).

data/vxxx/... for all data files.

I'll let you know.


David Casual Box(Posted 2013) [#8]
It's quite a mess. Nothing is working, or we need to modify Diddy, etc. to be able to store the assets in subdirectory.
Putting the whole app in a subdirectory does not work (the app continue to search files at the root directory of the page hosting the canvas).

We'll try an iFrame.

Sad.