I’ve been having an issue when I upload an updated version of my WebGL app to my Apache web server. Returning visitors who already used the app don’t receive the updated version, instead loading what seems to the old version in browser cache.
This has become a serious issue with one project where I changed the presentation format from PWA to Default. I completely deleted the folder on the web server and uploaded the new version, but returning visitors are still getting the PWA presentation page, this time with errors. It appears to be trying to load some parts of the new build, but that build is expecting the Default presentation. It’s a mess!
I’ve tried:
Disabling caching in the build options in Unity.
Adding the following to the .htaccess file in the root of the WebGL app:
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</IfModule>```
Neither has helped.
Note that new users, and users that have cleared their browser cache do not have any issue, however I can't ask my returning visitors to clear their cache every time there's an update.
Any assistance is appreciated, thank you!
Did you try to use Name Files as Hashes from the settings? I think this should fix your problem, since there there will be no cached version of a file, if the name of that file changes due to a different hash.
I went through this a while back, and part of resolving it was needing to execute a line of JavaScript (shared in the thread linked below) when the page loads. My game’s loading time had slowly been increasing until it was like 30s each time, but after this it went down to less than 1s (from the time the Unity logo disappears until the first scene appears). I haven’t needed to do it for ages now (presumably since upgrades have been 2022.x->2022.x), but this worked in Chrome, Edge and Firefox to reset/clear the IndexedDB cache on demand: