Skip to content

Only serve offline/error page if Offline Browsing is enabled; conditionally install service worker #436

@westonruter

Description

@westonruter

As mentioned in #344 (comment):

I wonder if this should also control whether we serve the Offline page and the Server Error page.

This was not implemented in #365 but after thinking about it more, it seems the right way to go. Furthermore, the service worker should only ever be installed if there is any SW logic registered to run in it. So if the offline/error page is included with offline browsing, and offline browsing is not enabled, then there would be no SW logic registered and the SW should be skipped from being installed. As soon as that checkbox is enabled or if a plugin registers a script to run in the service worker, then the SW would then be installed automatically.

There probably needs to be a new conditional function added to check whether the SW is being installed.

By not installing the service worker by default, we'll avoid situations where the SW is responding to requests unexpectedly, which can cause confusion. It will also reduce extraneous SW installation across the web, reducing the service workers that are installed but aren't doing anything much of value.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions