w3c / ServiceWorker

Service Workers
https://w3c.github.io/ServiceWorker/
Other
3.63k stars 313 forks source link

Expose `display` mode (e.g. `standalone`) on `client` #1370

Open slightlyoff opened 5 years ago

slightlyoff commented 5 years ago

Per a recent partner conversation, it can be useful at fetch time to understand the display mode of the client making a fetch. In keeping with our principle of telling developers what we know which they could already get in an inelegant way, we should perhaps expose this on Clients.

It's very inelegant to get this data from the Service Worker context today; it's only available via DOM through a media query, and propagating it through to a fetch is difficult.

tomayac commented 5 years ago

This could maybe be a Client Hint as well!?

NekR commented 5 years ago

Will it work for the navigations in standalone mode? It’s indeed hard to detect standalone mode from SW this days and especially hard to mark all requests from standalone mode for analytics.

Client Hints, indeed, would be appreciated in this case too, so you won’t need to add custom headers yourself.

On Thu, 15 Nov 2018 at 04:17, Alex Russell notifications@github.com wrote:

Per a recent partner conversation, it can be useful at fetch time to understand the display mode of the client making a fetch. In keeping with our principle of telling developers what we know which they could already get in an inelegant way, we should perhaps expose this on Clients.

It's very inelegant to get this data from the Service Worker context today; it's only available via DOM through a media query, and propagating it through to a fetch is difficult.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/w3c/ServiceWorker/issues/1370, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIlkZbnZO8dL_w4j0Ess898nwwg3TZPks5uvMCegaJpZM4Ye5RK .

-- @nekrtemplar https://twitter.com/nekrtemplar

pavanratnakar commented 5 years ago

Thank you for opening issue

jakearchibald commented 5 years ago

Pre TPAC thoughts: