Auto-updating and downloading libraries


#1

Hello there !

I was wondering if that is possible to ask index.html to look for the libraries online through the CDN, and if these are not available (because of server connexion failure, airplane mode,…) it uses local libraries files.

Moreover, it would be great that if the connexion is established with the online server, it updates local libraries files in order to be able to use them offline later.

I don’t know if its possible to write it directly in html or if it requires to use a script file written in another language, nor whether it’s easily accessible for newbies.

Does anyone have some suggestions ?
Thank you !


#2

It sounds like what you’re looking for is service workers. They aren’t exactly newbie-friendly, but there is a Google developers page walking through how to set one up, and there’s this talk that goes through the main concepts.