w3c / w3c/ServiceWorker

Notion of a "session" across same-origin navigations

Open
#1,660 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Bikeshed
Stars
3.6k
Forks
324
Avg merge
14d 22h
Merged PRs (30d)
1

Description

Currently when navigating inside the same origin, the client is removed and a new client ID is created.
With cookies being a blocked header, this makes it so that SWs don't have the knowledge to maintain information across navigations in the same session (the same session as in sessionStorage).

Maybe something in the navigation API is supposed to fix this or there's a separate issue that I didn't recognize. The issues mentioning access to the cookie storage are somewhat orthogonal to this.

The use case is maintaining some sort of MPA session state in the service worker as a cache to the cookie-based session state on a server.

A possible small-ish API that would enable this: adding a previousClientId to navigation request fetch events.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the navigation API and service-worker navigation request fetch events described in the issue, comparing their behavior with sessionStorage and cookie storage. Determine whether a previousClientId or another mechanism should preserve state across same-origin navigations; done means documenting a decided API direction and its session semantics.

Written by the indexing model from the issue text.

Assessment

Domain
api, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.