diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js index d9165a280ec265551fe559549fbfdab19a934813..e2cd38783734eb6519d7705e7c8f1379eb914803 100644 --- a/src/registerServiceWorker.js +++ b/src/registerServiceWorker.js @@ -26,15 +26,19 @@ if (process.env.NODE_ENV === 'production') { console.log('New content is downloading.'); }, updated (registration) { - alert('Une nouvelle version de l\'application est disponible, l\'application va se recharger'); - console.log('New content is available; please refresh.'); - // - if (!registration || !registration.waiting) { - return; + if (!navigator.webdriver) { + alert('Une nouvelle version de l\'application est disponible, l\'application va se recharger'); + console.log('New content is available; please refresh.'); + // + if (!registration || !registration.waiting) { + return; + } + // Send message to SW to skip the waiting and activate the new SW + registration.waiting.postMessage({ type: 'SKIP_WAITING' }); + //window.location.reload(true); + } else { + console.log('Execution dans un navigateur controlé par un agent automatisé, la mise à jour n\'est pas appliqué pendant le test.'); } - // Send message to SW to skip the waiting and activate the new SW - registration.waiting.postMessage({ type: 'SKIP_WAITING' }); - //window.location.reload(true); }, offline () { console.log('No internet connection found. App is running in offline mode.');