How to cache signature files (Service worker)

Asked

Viewed 29 times

0

Several front-end applications implement a signature template in the files to control the cache, and each change in the file this signature changes.

Signature examples:

sw-d58e3582afa99040e27b92b13c8f2280.js sw.js? _gc=20180101

How to make Service Worker know how to handle these signatures and cache?

+details I am working on an application already ready, trying to implement service worker for certain functionalities to be available offline.

Example, in this excerpt I need to say what I will cache, however, the application changes the signatures of the file to control the cache. (today is like this)

caches.open('my-cache').then(function(cache) {
return cache.addAll([
    '/index.html',
    '/styles.css',
    '/main.js'
]);})

The application is always changing "Styles.css" to "Styles.css? v=1527624807103_1" (timestamp) As far as I understand it, not "Styles.css" is not the same as "Styles.css? v=1527624807103_1".

  • please could explain a little better and if possible put an example?

  • @Alexandrecavaloti tried to put more information in the first text. I hope to have clarified a little more...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.