How can I get the current application version number (of our web app) and the published application version using JavaScript code? I need to know this information so I can write a JavaScript script that checks every 15 minutes if a new update is available, and shows the user a popup message asking them to refresh the web page.
You can access the version number in your deployments. Save it somewhere and then check the cacheVersion against the deployed version number.
// Get the cache version of the application
let version = window.wwg_cacheVersion;
// Update the variable ['cacheVersion]
wwLib.wwVariable.updateValue('80e49d79-......-8cd291322232', version);
console.log("version: ", version)
return version;
For context, I’m using self hosting. When I make a deployment I save a deployment log in my db with the version number. Then I use a workflow On App Load to check whether the cacheVersion matches the latest deployment version. If false, show a a banner message or force a refresh.
When I make a deployment I save a deployment log in my db with the version number.
So you use a third-party service like Xano to fetch the version number? I want a solution without any dependencies.
What I would do is use my prompt, and paste your service worker there for the ChatGPT to alter it accordingly. The prompt I shared is just an example, it’s not in a WeWeb context, even though very similar.
I am currently using this code, but the message box (set by a variable) is always on top. When I click the refresh button in my message box, the message box still keeps showing. Each refresh the code think there is a new version. Does anyone have any suggestions on what might be causing this issue and how to solve this problem?