-
Notifications
You must be signed in to change notification settings - Fork 31
Request for dynamic preload like font url in CSS. #144
Comments
FWIW, we actually have something like this for image preloads that match the |
That's interesting! For the font case, I don't think there's a huge use-case right now (all browsers that support preload support woff2). But, we have been discussing ways to preload |
Are you saying we cannot force users to modify their |
The latter. Legacy browsers would not recognize those new elements, which would result in them implicitly starting the |
Taking a second look at this, this will not work because |
This seems highly related to whatwg/html#6400 IIUC. Essentially asking for "type" based preloading from multiple options. Closing as this repo is discontinued. I encourage y'all to continue the discussion on the HTML repo. |
Problem
The browser supports different formats, ex: Chrome supports WebP and Safari doesn't. Some resources are critical and should be pre-loaded, but can be present in diffrent formats according to the browser.
Below is the example for how someone will load font for diffrent browsers, but if the browser supports 2 or 3 of the format it will load all supported font formats. This will be a wastage of resources at critical rendering time.
Suggested Solution
This preload with
group
attribute will download only one resource and will stop when it finds a compataible format. Every child of the group will be treated as same object defined inas
attribute.Use Cases
For a media-heavy site, this will be a great optimization of resources. We can preload only one Image according to supported formats, the same goes for Audio, Video, and Fonts.
I am a newbie and don't know how to edit web specs but I feel this feature important in many use cases.
Present implementation
This type of thing happens in CSS's
@font-face
src. Example is taken from https://developer.mozilla.org/en-US/docs/Web/CSS/@font-faceThe text was updated successfully, but these errors were encountered: