Skip to content
This repository was archived by the owner on Mar 26, 2018. It is now read-only.
This repository was archived by the owner on Mar 26, 2018. It is now read-only.

404 not found for service worker in root directory #1420

Description

@simran66

There is app folder that has the application content.

  1. If I register service-worker in app folder, I cannot cache bower components and then app does not work offline.

  2. If I register service worker outside of app folder, index.html which is in app folder, is never able to find path of servie-worker.js which is outside of app folder, in the root directory.

I have tried this in index.html:

if( 'serviceWorker' in navigator ) {
    navigator.serviceWorker
      .register( '../service-worker.js' , { scope : ' ' } )
      .then( function( ) {
        console.log('Congratulations!!Service Worker Registered');
      })
      .catch( function( err) {
        console.log(`Aagh! Some kind of Error :- ${err}`);
      });
  } else {
    console.log("SW NOT SUPPORTED");
    //still not supported
  }

But I only get 404.

I have also tried using absolute path i.e

.register( '/service-worker.js' , { scope : ' ' } )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions