Skip to content

Add a leading slash to ensure the SW gets registered at the site root#1

Open
Trippnology wants to merge 1 commit into
wookiehangover:masterfrom
Trippnology:register-sw-at-root
Open

Add a leading slash to ensure the SW gets registered at the site root#1
Trippnology wants to merge 1 commit into
wookiehangover:masterfrom
Trippnology:register-sw-at-root

Conversation

@Trippnology

Copy link
Copy Markdown

Without a leading slash, the service worker registration URL is relative to the current page, rather than to the site root. source

This causes a problem when visiting a sub-page such as example.com/some/path as the SW tries to register at example.com/some/service-worker.js

As service workers should be registered at the site root, hopefully this change should be right for everyone.

Thanks for this module - I was up and running in minutes! :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant