Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force an update of a Single-page application

I work on a AngularJS Single-page application which once loaded (all the resources are fetched from the HTTP server) only accesses the REST backend to get/send data. The task is how to make sure users are always using the latest version of the frontend code (.js, .css and .html files) when the users never leave the page and never refresh the browser.

I think there are several options:

  1. the frontend asks the HTTP server every N minutes what is the latest frontend code version
  2. the backend includes the latest frontend code version in every response (e.g. an additional HTTP header) which is inspected by the frontend code
  3. the backend returns a cookie with the latest frontend code version and checks if the version provided by the user is outdated
  4. websocket connection between the browser and the backend (not an option for me)

Do you know other approaches?

like image 925
Adam Siemion Avatar asked Sep 19 '25 04:09

Adam Siemion


1 Answers

you can also use html5 application cache, this way every time something changes, the website will update itself in the first visit, pretty handy and faster than ordinary cache.

like image 84
Mohsen Shakiba Avatar answered Sep 21 '25 20:09

Mohsen Shakiba