I am using jserver as the backend. I have to put banano app in the server's www folder as XMLHTTPrequest does not support cross-origin.
I use the following command to copy the built banano files to the www folder:
B4X:
' start the build
BANano.Build(File.DirApp)
Log("copying...")
Dim sh As Shell
sh.Initialize("","xcopy.exe",Array("/E/Y","C:\Users\xulihang\Documents\B4J\TRMS\frontend\Objects\Search\*","C:\Users\xulihang\Documents\B4J\TRMS\backend\Objects\www"))
sh.RunSynchronous(5000)
Log("done")
But I found the files are cached and I need to clear cache to see the updated result.
What is the correct way to prevent this from happening?
Using a ServiceWorker has its own sort of 'cache'. It is intended to cache everything, so even when the website is offline, the website works.
I will upload a new version of BANano today (v2.32) which should improve the ServiceWorker update system.
This will be important:
B4X:
BANano.Initialize("BANano", "ChatNoir", DateTime.Now) '<--- also update the version here, so that the service-worker.js file actually changes.
BANano.JAVASCRIPT_NAME = "app" & DateTime.Now & ".js"
This is what should happen on pressing F5 because of that first line if I recompile: