rel=preload links do not download if media type does not match
Reported by
sc...@filamentgroup.com,
Dec 5 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:57.0) Gecko/20100101 Firefox/57.0 Steps to reproduce the problem: 1. Reference a CSS file with <link rel=preload href=mycss.css media="(min-width: 800px)" onload="this.rel='stylesheet'> 2. Load page at a viewport size narrower than 800px 3. The stylesheet file will not be downloaded. (It also will not download if the browser is later resized to a viewport size wider than 800px). Simple demo page is here: https://254-origin-loadcss.fgview.com/test/preload-control.html What is the expected behavior? It's unclear if this is the expected behavior, but our assumption was that the link will download (but not necessarily apply) regardless of whether the media matches, much like a rel=stylesheet link will. What went wrong? The link did not cause the resource to fetch. Did this work before? N/A Does this work in other browsers? N/A Chrome version: 62.0.3202.94 (Official Build) (64-bit) Channel: stable OS Version: OS X 10.12 Flash Version: Shockwave Flash 27.0 r0 The spec doesn't seem completely clear on what the behavior should be for non-matching media links both at load and later in the session when the media matches.
,
Dec 5 2017
A note is probably good, yeah, just to remind people. I do agree with this behavior in general — the `media` attribute is operating on the correct level. The "correct" code would be: <link rel=preload href=mycss.css onload="this.rel='stylesheet'; this.media='(min-width: 800px)'">
,
Dec 27 2017
Yoav, could you work on this (adding a note to the spec)?
,
Dec 27 2017
Yeah, I'll add a note.
,
Jan 9 2018
Added a note: https://github.com/w3c/preload/pull/117 Closing as WontFix |
|||
►
Sign in to add a comment |
|||
Comment 1 by y...@yoav.ws
, Dec 5 2017