0

My code to load JavaScript file is:

<script src="/path/to/app.js?1350550684711"></script>

where 1350550684711 is just a server-side generated timestamp. This practice of cache busting is quite popular (link 1, link 2).

In Chrome and Firefox this mechanism works, and in theory it should work for all browsers, since a different HTTP resource is being requested every time.

Still reports are coming in of users using cached versions of the JS file; specifically those on Apple Safari. Any idea?

Community
  • 1
  • 1
Joseph Victor Zammit
  • 14,760
  • 10
  • 76
  • 102

1 Answers1

1

That could mean that the affected Apple Safaris reuse a cached version of the html page that contains the <script elements, and thus naturally they would not get a new timestamp from the server.

I'm speculating here, but that could be because they interpret the HTTP cache related headers differently, potentially due to differing default settings, offline browsing mode or whatever.

Check which cache settings apply to that html file.

Evgeniy Berezovsky
  • 18,571
  • 13
  • 82
  • 156