-1

Scenario:

  1. User is logged in.
  2. Site is updated.
  3. User has cached html/js and calls an old endpoint. The world ends.

I know sites often say something along the lines of "The product has been updated, refresh your browser." But how is this normally done?

I can imagine two ways:

  1. Occasionally make call to db on navigation, check version stored in angular constant against version stored in db. If mismatch, notify.
  2. Some sort of scenario with SignalR pushes to check even if the browser isn't making any actions on the site.

Am I missing anything? What's a good way to do this given our stack (see tags)?

VSO
  • 11,546
  • 25
  • 99
  • 187

1 Answers1

1

If you really do not want stuff cached, for the HTML, you will need to add the necessary meta tags to the

    <meta http-equiv="Cache-control" content="no-cache" />
    <meta name="expires" content="wed, 15 Sep 1993">
    <meta http-equiv="pragma" content="no-cache" />

for js references, you would need to cache-bust them either by appending a token to the filename like:

    <script src="/path/to/script/myscript_1234567890.js"></script>

or

    <script src="/path/to/script/myscript.js?v=1234567890"></script>
ether6
  • 351
  • 3
  • 10