Progressive Web App's?

Has anyone tried to convert a Rapid Weaver Website to a Progressive Web App (PWA). It looks like a process where a Manifest and a Service Worker are created and included into the html code and.
I have made the website a Responsive Website in Rapid Weaver, however, according to the online discussions, one can create a PWA from your HTTPS website that will work like a Offline Mobile App (not Native) and it would ask the person if they would like to add the website to their Home-Screen through a Notification. It can also send Notifications to the person.
All the different sizes of Icons are also included in the html.

Any ideas? I have created the Manifest and the Service Worker.

//This is the “Offline page” service worker

//Add this below content to your HTML page, or add the js file to your page at the very top to register service worker
if (navigator.serviceWorker.controller) {
console.log(’[PWA Builder] active service worker found, no need to register’)
} else {
//Register the ServiceWorker
navigator.serviceWorker.register(‘pwabuider-sw.js’, {
scope: ‘./’
}).then(function(reg) {
console.log(‘Service worker has been registered for scope:’+ reg.scope);
});
}

//This is the “Offline page” service worker

//Install stage sets up the offline page in the cache and opens a new cache
self.addEventListener(‘install’, function(event) {
var offlinePage = new Request(‘offline.html’);
event.waitUntil(
fetch(offlinePage).then(function(response) {
return caches.open(‘pwabuilder-offline’).then(function(cache) {
console.log(’[PWA Builder] Cached offline page during Install’+ response.url);
return cache.put(offlinePage, response);
});
}));
});

//If any fetch fails, it will show the offline page.
//Maybe this should be limited to HTML documents?
self.addEventListener(‘fetch’, function(event) {
event.respondWith(
fetch(event.request).catch(function(error) {
console.error( '[PWA Builder] Network request Failed. Serving offline page ’ + error );
return caches.open(‘pwabuilder-offline’).then(function(cache) {
return cache.match(‘offline.html’);
});
}));
});

//This is a event that can be fired from your page to tell the SW to update the offline page
self.addEventListener(‘refreshOffline’, function(response) {
return caches.open(‘pwabuilder-offline’).then(function(cache) {
console.log(’[PWA Builder] Offline page updated from refreshOffline event: '+ response.url);
return cache.put(offlinePage, response);
});
});

Does anyone know where this code need to be included in the Rapid Weaver Site?

Thank you,

R

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.