Using ServiceWorker in Cordova

Viewed 3774

We have been happily developing our app using Service Workers because of the ease of building an offline app.

It's registered in the usual way:

navigator.serviceWorker.register( "./worker.js" ).then( function () {
  console.log( "woohoo!" );
}, function ( err ) {
  console.log( "oh noes", err );
});

And it is actually quite simple:

self.addEventListener( "install", function () {
    console.log( "yay" );
});

It works fine while developing in the desktop browser, behind a web server.

But is there a way to use it while in Cordova/Crosswalk, as they use the file protocol?

0 Answers
Related