Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for client hints #121

Open
dvtkrlbs opened this issue Jun 15, 2024 · 6 comments
Open

Add support for client hints #121

dvtkrlbs opened this issue Jun 15, 2024 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@dvtkrlbs
Copy link

Client hints currently experimental. Maybe we can implement some features of it using a feature flag. Especially the Sec-CH-Prefers-Color-Scheme header could be useful to setup dark mode on the server to prevent flash on non dark mode content.

@maccesch
Copy link
Contributor

Sounds like a good idea. First we have to add a PR to web_sys to support the API.

@maccesch maccesch added the enhancement New feature or request label Jun 16, 2024
@maccesch maccesch changed the title Discussion: Setting up client hints Add support for client hints Jun 16, 2024
@maccesch maccesch added the help wanted Extra attention is needed label Jun 16, 2024
@dvtkrlbs
Copy link
Author

@maccesch from what I read it doesn't need any kind of client side feaute. Since everything only via headers. We just need the integration via axum since at first response server responds with critical hints and client retries the request.

@maccesch
Copy link
Contributor

For #101 we only need the server side part indeed because the client side is already handled. But even in that case we're probably interested in being able to read it on the client as well.

For a general purpose client hints function we definitely need client side. Pages should work the same as much as possible between being rendered on the server or on the client.

This is the client API: https://developer.mozilla.org/en-US/docs/Web/API/User-Agent_Client_Hints_API

@maccesch
Copy link
Contributor

I made a PR for web_sys: rustwasm/wasm-bindgen#3989

@dvtkrlbs
Copy link
Author

dvtkrlbs commented Jun 17, 2024

@maccesch these are the user agent client hints api and I was mostly considerign User preference media features client hints css features where you can get for example Sec-CH-Prefers-Reduced-Motion, Sec-CH-Prefers-Color-Scheme. These already have client side apis. But yeah for the user agent ones that makes sense.

@maccesch
Copy link
Contributor

maccesch commented Jun 17, 2024

Yes, but while we're at it we might as well do it right, don't you agree?

As far as I read it you're talking about a subset but when we implement this API I'd rather do it all at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants