Programmatically clear HTML 5 application cache in log-on/log-off scenario

独自空忆成欢 提交于 2019-12-10 17:29:44

问题


HTML 5 offline logic is encapsulated in window.applicationCache object. However it looks like it's not possible to programmatically clear cache data, for example, when user logs off from the system. Is there any other way to clear HTML 5 application cache, except for generating empty manifest file?


回答1:


Setting aside the specifics of the HTML5 appcache, clearing a browser's cache programmatically has never been possible (beyond certain ActiveX controls for that browser) so I suspect you may come up empty on this one. Perhaps you should focus on the cache control meta tag and test further with your empty manifest idea?




回答2:


Have observed this on Chrome not sure if that's the standard way, if server responds with 404 on manifest file request, cache gets cleared from browser after raising obsolete event.




回答3:


I think the best way to do this is to change the link to the manifest file. In this case I would append the user's session ID to the manifest file. Every user should have session regardless of logged in status and the session ID should probably changed when logging in/out (maybe).

I also found this answer: Removing HTML5 Appcache Manifest, Permanently



来源:https://stackoverflow.com/questions/6653871/programmatically-clear-html-5-application-cache-in-log-on-log-off-scenario

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