locked
Progressive Web App (PWA) service worker not recognized RRS feed

  • Question

  • User379720387 posted

    Trying to make my web app pass the Lighthouse PWA test. So far it fails on not having a service worker.

    I want to use google suggested version which I got here

    The service-worker.js file lives in my Scripts/js and I have a reference to it in SiteLayout: <script src="~/Content/js/service-worker.js"></script>

    The file is loading according to Sources in developer tools.

    What else do I need?

    Saturday, August 19, 2017 9:53 AM

Answers

  • User475983607 posted

    wavemaster

    Going down the checklist of the Lighthouse PWA check.

    First item on the list is the missing service worker.

    Where does it need to live, and do I give it the same reference treatment like any other js file?

    This is a question for Lighthouse support.  Perhaps the requests are not over HTTPS?

    Again a PWA is framework.  According to Google you need to register the service worker.  I'm a bit confused... did you purposely build a PWA?

    https://developers.google.com/web/ilt/pwa/introduction-to-service-worker

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 19, 2017 10:53 AM
  • User379720387 posted

    Lighthouse is a generic utility that tests the conditions necessary for an Web App (WA) to be a PWA.  It is platform independent.

    Major browsers support PWA, they all talk about service workers and more. Here is a little blurb from Mozilla: https://developer.mozilla.org/en-US/Apps/Progressive

    And here is Microsoft: https://blogs.msdn.microsoft.com/premier_developer/2017/05/03/introduction-to-progressive-web-applications-pwa/

    My WA was not specifically designed to be anything other than a site.  The way I understand things is that the "progressive" aspect comes from some js wrapper.

    From this msdn video I was able to glean how the service worker gets registered, plus some cool things from Microsoft on how they think PWA's will be treated inside the Windows eco system. In this video there is also mention of what Microsoft will do to give access to on device functionality like camera, contacts, etc.

    Here is a link to the PWA builder, and here is the link to the app image generator.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 24, 2017 7:15 PM
  • User-627724879 posted

    Your service worker should be in your site's root folder. Service workers are limited to a scope. By placing it in your scripts/js folder the service worker only controls pages in the scripts/js folder and below. This is why your service worker is not recognized.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 26, 2017 3:33 PM

All replies

  • User475983607 posted

    You realize that a PWA is not just adding a reference to service-worker.js, correct?  A PWA is an overall design strategy.  Did you build a PWA?

    Saturday, August 19, 2017 10:15 AM
  • User379720387 posted

    Going down the checklist of the Lighthouse PWA check.

    First item on the list is the missing service worker.

    Where does it need to live, and do I give it the same reference treatment like any other js file?

    Saturday, August 19, 2017 10:22 AM
  • User475983607 posted

    wavemaster

    Going down the checklist of the Lighthouse PWA check.

    First item on the list is the missing service worker.

    Where does it need to live, and do I give it the same reference treatment like any other js file?

    This is a question for Lighthouse support.  Perhaps the requests are not over HTTPS?

    Again a PWA is framework.  According to Google you need to register the service worker.  I'm a bit confused... did you purposely build a PWA?

    https://developers.google.com/web/ilt/pwa/introduction-to-service-worker

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 19, 2017 10:53 AM
  • User379720387 posted

    Lighthouse is a generic utility that tests the conditions necessary for an Web App (WA) to be a PWA.  It is platform independent.

    Major browsers support PWA, they all talk about service workers and more. Here is a little blurb from Mozilla: https://developer.mozilla.org/en-US/Apps/Progressive

    And here is Microsoft: https://blogs.msdn.microsoft.com/premier_developer/2017/05/03/introduction-to-progressive-web-applications-pwa/

    My WA was not specifically designed to be anything other than a site.  The way I understand things is that the "progressive" aspect comes from some js wrapper.

    From this msdn video I was able to glean how the service worker gets registered, plus some cool things from Microsoft on how they think PWA's will be treated inside the Windows eco system. In this video there is also mention of what Microsoft will do to give access to on device functionality like camera, contacts, etc.

    Here is a link to the PWA builder, and here is the link to the app image generator.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 24, 2017 7:15 PM
  • User-627724879 posted

    Your service worker should be in your site's root folder. Service workers are limited to a scope. By placing it in your scripts/js folder the service worker only controls pages in the scripts/js folder and below. This is why your service worker is not recognized.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 26, 2017 3:33 PM
  • User379720387 posted

    thank you.

    Wish I had found your site a few months ago.

    Tuesday, September 26, 2017 8:29 PM