WebPagetest Forums

Full Version: HTTP2 PUSH media queries not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
when I use the HTTP Link header, e.g. as seen here: https://phabricator.wikimedia.org/phame/...rce_hints/

Link: </static/images/project-logos/enwiki.png>;rel=preload;as=image;media=not all and (min-resolution:1.5dppx),</static/images/project-logos/enwiki-1.5x.png>;rel=preload;as=image;media=(min-resolution:1.5dppx) and (max-resolution:1.999999dppx),</static/images/project-logos/enwiki-2x.png>;rel=preload;as=image;media=(min-resolution:2dppx)

Webpagetest.org will HTTP Push ALL files, not only those that would apply.
When testing it in Chrome on my laptop, it works fine however.
Dev tools is probably only showing you the pushed resources that the browser actually claimed. It doesn't have any visibility into the pushed resources that are abandoned (those are held deep in the net stack). If you capture a netlog (about://net-internals) on your dev box you will see the pushed resources that aren't claimed.

Preload knows how to do media queries but push doesn't since push is initiated by the server.
thanks for the quicky reply

isn't that the same.
preload via link HTTP header is PUSH, isn't it?

on the link provided from wikimedia (https://phabricator.wikimedia.org/phame/...oad_links/) they put a link rel="preload" header with a media query - which as far as I understand (& what webpagetest.org says when checking) is PUSH?
Chrome dev tools seems to by default hide unused resources pushed by server.

You can't use media queries on HTTP2 push, at least not the way you think. The server/CDN has no idea what resolution the user has so it pushes all content. User browser may decide to cancel transfer of some pushed content but unless you're pushing a lot of data (big file(s) or a lot of files) it won't improve performance as by the time server receives the cancel notification from user browser the data will be already pushed through pipe. Plus I'm not sure if any browser actually does such optimization.

Oh, and preload is not the same as HTTP2 push.
Reference URL's