HTML5 application cache - cached files do not update, even when manifest is updated

自作多情 提交于 2019-12-13 16:45:57

问题


I have a versioned cache manifest:

#version = e5b4271

Every time this version changes, my webapp loads the new manifest, but it never loads update files from the server. Even when I clear the browser cache (not the application cache itself), or hit Ctrl+Shift+R to force it to fetch a new version, it still loads the files from the old appcache.

The only way I can get it to update is to clear the browser's application cache in settings, but obviously this is unacceptable because I need it to update for regular users.

Any ideas why this would happen?


回答1:


Just figured it out. I'm using Flask's development server, and it seems by default (via werkzeug) it sends cache headers for 12 hours for static files. Adding the following to my flask config solved this:

SEND_FILE_MAX_AGE_DEFAULT = -1

If anyone else has this issue, check your server config to make sure cache headers are not sent with static files. You can check this in the network tab in chrome during the first load of the file.



来源:https://stackoverflow.com/questions/12980792/html5-application-cache-cached-files-do-not-update-even-when-manifest-is-upda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!