DEV Community

Discussion on: How to detect and update to the latest version with Nuxt PWA

Collapse
 
camohub profile image
camo • Edited

I am not sure if I understand it right. So if I make a new build on the server and user have old version open in the browser, this plugin will detect new version and automatically update refresh the page?

I am not able to test it on localhost cause it refresh the page automatically. Is it possble to test it on localhost? If I add this lines at the beginning of the plugin

else {
console.log('Workbox has been loaded.');
}

I dont see any log in console.

Collapse
 
alejandroakbal profile image
Alejandro Akbal
  1. Yes, once the new version is published on the server, when a user loads your website it will reload automatically without the users needing to click the reload button, or implementing a update button on your website.

  2. As far as I know, workers don't execute on localhost, so you cant test it.

Collapse
 
chrissyast profile image
chrissyast

@alejandroakbal What do you mean by 'when a user loads your website'? I thought that the use case for this is that the site is already loaded and in the background the code realises that a newer version is available and forces the browser to refresh.