Jump to content

Need help for cache controlling (ApplicationCache)


swen
 Share

Recommended Posts

Hi guys,

 

I'm working on a HTML5 game, but I have some problems about the cache controlling. I posted it on StackOverFlow, for convenience I paste the question below.

 

Currently I'm working a mobile app using HTML5 applicationCache, however, my app has lots of images that make my app very large. I don't want to list images in CACHE section, because:

  1. Listing images under CACHE section would requires more offline cache memory, it may exceed the browser's limit;

  2. Downloading images would take too much time before using my app. In fact, some images would only be used after some user's interaction.

So, here is my idea to solve this problem:

  1. List my scripts and some important images in CACHE section, users would only need to download small size files before they can use app. (I put scripts in CACHE because I would release app frequently, I want users to have newest code every time they visit. Also, they can still use my app offline.)

  2. Download other images on need, and cache these images in browser's ordinary cache(NOT applicationCache). Next time user visit my app, these cached images need not to be download again. (I just set NETWORK:* to the manifest file)

However, I found out that the NETWORK section of application cache would never be cached. Even users visit my app several times, they need to download those images every time, which took a lot of time and bandwidth.

 

Also, I tried normal browser cache instead of applicationCache. Loading and reloading images works quite fast, however, if I publish my game with new images, the browser still uses old images.

 

Many thanks for any help :)

Link to comment
Share on other sites

Hi swen,

 

The AppCache is awkward at the best of times, so it might be worth changing your design to not rely on it so much. I think

5MB is the standard app cache limit, 5MB of is quite a lot when you consider all the compression/minification techniques available.

 

Additionally if you're planning to update your app "frequently", can you postpone the initial release until you have a lot of

functionality already built that doesn't require constant updates? It could save plenty of headaches.
 

In relation to the browser still using the old images, are you updating the image content or the manifest file? The manifest

file itself needs to be changed in order to force downloads of changed content. You can do this very easily by storing a

commented version number in your manifest file and incrementing it when there's new content - the browser will detect

the change and attempt to reload the page.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...