简体   繁体   中英

Is there some versioning in ReactJs that when set like in index.html automatically make browser get app again?

I learn Reactjs and read somewhere about this but cant find it now. how
to make the browser updated download the app files.
Again typically after a new release has been published?

Cache-control?

Like when I build a new version 1.0.1 and then next time 1.0.2 and then the browser should detect this and re download the changed files into browser cache.

Is there such thing?

UPDATE here is my index.html with some Cache-control that dont work correctly

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=0" />
  <meta http-equiv='cache-control' content='no-cache'>
  <meta http-equiv='expires' content='0'>
  <meta http-equiv='pragma' content='no-cache'>

..........

That functionality is built right into the HTTP protocol, but it works based on timestamps, not on versions.

With the HTTP request for your app's script, the browser sends along a timestamp of the cached version.

If that version is newer than the version on the server (ie it is up to date), the server replies with HTTP 304 Not Modified, and an empty body.

If the browser's version is out-of-date, the server will instead reply with HTTP 200 OK and the actual script.

(Note that this is subject to browser and server configuration, but this is how it is supposed to work, and usually does.)

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