Force clear cache in OpenUI5

眉间皱痕 提交于 2019-12-22 00:14:27

问题


I have created an OpenUI5 app and I want to relase a new version daily. But I found some problems:

  1. Not always on the client browser is loaded the last version of javascript (I have a label that show the version and to see the last number is requred a manual refresh by F5)
  2. I have a JSon file that i use to bind a menu. If I modify it, on the client browser it remains in cache and also with F5 not load the new version. The solution is clear data of browser (...)

Now I have this meta-tags on my index page:

<meta http-equiv="expires" content="0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />

Is there a way to force the reload of all content always? (or when I modify the version number?)


回答1:


This really depends on what server you are using to serve the content and whether you can set the headers when it serves the various JS files to the client. Unfortunately this is probably just disabling the cache all the time.

There is also a built in concept called "Cache-buster" which is documented here - OpenUI5 Cache Buster. This does something clever and puts a timestamp or version number in the url which is read from a config file. If you are hosting on an ABAP stack then this is built in for you and easy to enable, if you aren't it's still easy to manually implement.




回答2:


I have solved my problem using ONLY

 <meta http-equiv="cache-control" content="no-cache" />

as show in this post:

https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching



来源:https://stackoverflow.com/questions/26603161/force-clear-cache-in-openui5

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