'Confusion about scope property in web manifest

I'm confused about what should be my scope property in my web manifest file.

Say, if my start_url is set to https://www.example.com/, should my scope be "/" or the same as start_url?

I'm using Vue3.

Note: The main issue that I'm facing is the service-worker not getting detected by the browser and it figures out setting an appropriate scope could solve the problem it.



Solution 1:[1]

The scope field in the web app manifest defines something different than a service worker registration's scope.

Setting scope in your web app manifest is not required to use a service worker or have it detected.

If you could provide some more details about how you're registering your service worker in your question, we might be able to help you further. Additionally, "The service worker lifecycle" documentation has a lot of best practices for using service workers. I did want to share this answer to at least clarify the difference between those two scope values.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeff Posnick