I have been tracking some of the forum topics going back to 2020. Is there any update on the Backendless platform regarding PWA development and deployment? I ask because we are looking at a PWA approach for our applications and would really want to leverage technologies such as Backendless to accomplish this.
Hi @Cobus_Smit ,
I’m running my web app as a PWA. To enable this, I’ve put a custom code block on my home page into the event “On Page Enter”. This code block can contain the following code (or similar):
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js', { scope: '/' })
.then ( registration => {
console.log('Service worker registration successful, scope is:', registration.scope);
console.log('Checking for updates now ...');
registration.update();
})
.catch(function (error) {
console.log('Service worker registration failed, error:', error);
});
}
In addition you have to put the file sw.js into the folder where the index.html of the web app is located. In this file, you are doing the service worker stuff you want to do.
The last thing is to place the webmanifest.json in the same folder as sw.js.
Hi all,
I’d like to deploy my app as a PWA so I might try your solution. But 1hat is inside these files? The sw.js and webmanifest.json?
In addition you have to put the file sw.js into the folder where the index.html of the web app is located. In this file, you are doing the service worker stuff you want to do.
The last thing is to place the webmanifest.json in the same folder as sw.js.