Can I reserve an object in browser cache?
I have a flex application about 2M need to send to browser, so I want the browser to reser开发者_如何学运维ve the file in cache forever unless I upgrade the version.
I have set the ETAG and last-modified tag in http reponse header, but sometimes, when the user click the refresh, the swf file still be reloaded.
So what http response header can I use to reserve the file in browser cache forever?
Since the file is relatively small (<5mb), you can store it in the offline cache. So long as the file doesn't change often, the offline cache is a great place for the file to live.
Check out:
HTML5 offline caching
You basically just specify an "application manifest" which lists the files that you want to keep around on the user's machine. The browser downloads and saves the files. When the browser requests those files again, they're retrieved from the offline cache instead.
Hope this helps!
精彩评论