Service Worker scope and SPA navigation
up vote
0
down vote
favorite
Let's say I load my website at https://example.com
, and I register my Service Worker at /app
.
I expect the SW to receive fetch
events when I navigate to https://example.com/app
.
However, if I navigate to /app
with history.pushState
, the SW doesn't receive fetch
events. If I then reload the page at https://example.com/app
, the SW does receive fetch
events.
Does the SW scope
not work for the History API?
javascript service-worker
add a comment |
up vote
0
down vote
favorite
Let's say I load my website at https://example.com
, and I register my Service Worker at /app
.
I expect the SW to receive fetch
events when I navigate to https://example.com/app
.
However, if I navigate to /app
with history.pushState
, the SW doesn't receive fetch
events. If I then reload the page at https://example.com/app
, the SW does receive fetch
events.
Does the SW scope
not work for the History API?
javascript service-worker
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Let's say I load my website at https://example.com
, and I register my Service Worker at /app
.
I expect the SW to receive fetch
events when I navigate to https://example.com/app
.
However, if I navigate to /app
with history.pushState
, the SW doesn't receive fetch
events. If I then reload the page at https://example.com/app
, the SW does receive fetch
events.
Does the SW scope
not work for the History API?
javascript service-worker
Let's say I load my website at https://example.com
, and I register my Service Worker at /app
.
I expect the SW to receive fetch
events when I navigate to https://example.com/app
.
However, if I navigate to /app
with history.pushState
, the SW doesn't receive fetch
events. If I then reload the page at https://example.com/app
, the SW does receive fetch
events.
Does the SW scope
not work for the History API?
javascript service-worker
javascript service-worker
edited Nov 7 at 7:59
asked Nov 7 at 7:47
Eric Guan
7,20521526
7,20521526
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
The fetch
event handler in a service worker will only be invoked when there's a network request. Changing the URL using the History API doesn't trigger a network request.
Reloading a page, or entering a new URL in the navigation bar and pressing Enter, does trigger a network request.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The fetch
event handler in a service worker will only be invoked when there's a network request. Changing the URL using the History API doesn't trigger a network request.
Reloading a page, or entering a new URL in the navigation bar and pressing Enter, does trigger a network request.
add a comment |
up vote
0
down vote
The fetch
event handler in a service worker will only be invoked when there's a network request. Changing the URL using the History API doesn't trigger a network request.
Reloading a page, or entering a new URL in the navigation bar and pressing Enter, does trigger a network request.
add a comment |
up vote
0
down vote
up vote
0
down vote
The fetch
event handler in a service worker will only be invoked when there's a network request. Changing the URL using the History API doesn't trigger a network request.
Reloading a page, or entering a new URL in the navigation bar and pressing Enter, does trigger a network request.
The fetch
event handler in a service worker will only be invoked when there's a network request. Changing the URL using the History API doesn't trigger a network request.
Reloading a page, or entering a new URL in the navigation bar and pressing Enter, does trigger a network request.
answered Nov 8 at 21:18
Jeff Posnick
28k46091
28k46091
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185323%2fservice-worker-scope-and-spa-navigation%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password