News for hackers. Stuff that matters.
Re:Removing HTTP/2 Server Push from Chrome by Koffiepoeder on Friday August 19, 2022 @01:02PM (#32523539)
Use css variables for colors, then load the relevant set with a 'prefers-color-scheme' media query. No need to serve 2 CSS assets: the difference should be minimal.
Re:Removing HTTP/2 Server Push from Chrome by jefftk on Friday August 19, 2022 @01:08PM (#32523594)
A stronger version of msoad's point would be deciding whether to push a dark or light image, based on the user's theme.
Re:Removing HTTP/2 Server Push from Chrome by msoad on Friday August 19, 2022 @04:19PM (#32525528)
You can solve this using the <picture> element. As Github does:https://github.blog/changelog/2022-08-15-specify-theme-conte...
Re:Removing HTTP/2 Server Push from Chrome by jefftk on Friday August 19, 2022 @07:36PM (#32527416)
We're assuming here that the site owner wants to push the image.; Having the client request a different image as a follow-up based on the user's preferences is a different solution, and there are lots of specific ways to do that.
Re:Removing HTTP/2 Server Push from Chrome by mikewhy on Friday August 19, 2022 @01:16PM (#32523687)
That sounds exactly like "The client should manage the resources on the client not the server"
Re:Removing HTTP/2 Server Push from Chrome by zamadatix on Friday August 19, 2022 @10:09PM (#32528354)
Nowadays absolutely. Worth keeping in mind HTTP/2 made it into browsers 4 years before that media query though. You can also request that info via header nowadays if you for some reason were really dead set on sending the minimal CSS directly.