简体   繁体   中英

Force clear cache in OpenUI5

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?)

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM