-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Link
header processing not defined
#4224
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
Comments
I think Firefox waits as well, which for |
AFAIK, the same is true for WebKit as well.
Agreed. At the same time, I think Chrome currently performs some optimizations that WebKit does not, so we need to spec language to allow for that. |
As Anne pointed out elsewhere, https://drafts.csswg.org/cssom/#requirements-on-user-agents-implementing-the-http-link-header seems worth looking into more, though it is relatively incomplete at the time of writing this. (Just making note of it here). |
As per https://bugs.chromium.org/p/chromium/issues/detail?id=19237, Chrome is not interested in implementing the Link rel=stylesheet headers, and I believe Firefox is the only browser that implements this feature. Should we consider removing this from the spec? I guess that would entail changing the CSSWG draft mentioned above, as well as mentioning in this spec that the What do people think about this? |
I agree that if this is only supported by one implementer then it should be removed from the spec. I guess Chrome does support Here's one idea for a plan:
|
I would like to see support for the Link header, I think this belongs in Web browsers. But I'm struggling to see how this is an HTML issue; especially since one of the use-cases is styling non-HTML media types (which is supported by CSS). So I think this should be factored out of HTML. Web browsers should be able to process a Link from multiple sources—an HTML |
The HTML Standard defines page load for all web browser resource types, not just HTML. See the section "Browsing the Web". |
@annevk That should be factored out. HTML has no business being the Web Browser Specification(TM) |
Says who? |
@domfarolino In short, RFC 6838; I opened #5639 to provide more details. |
@awwright - I doubt you'd have much success in convincing the HTML spec editors and browsers to modify how browsers' processing model is defined. Specifically for Link headers, if we were to properly define support for stylesheets, we would need to define how they interact with the cascade and in-document stylesheets. That definition needs to live in HTML. Link header support for stylesheets also introduces complications in case there are more than one header, as HTTP intermediaries can change the order of headers. That's contrary to the HTTP specification, but never the less is something I've seen happening, so I'd be highly reluctant to introduce content reliance on proxies doing the right thing, as in those cases applying those styles can result in different applicable styles based on e.g. which cache the page went through. At the same time, on the issue that's been open for the last 11 years, I haven't heard any strong use-cases as to why this is something that the web needs. If you have clear & strong use-cases for Link header application of stylesheets, I'm more than willing to hear them.
It would still be something that requires implementer interest in order to add such support in Chromium or WebKit. I'm not aware of such interest. |
I’m in favor of this feature and keeping it in the specification: It’s amazing to make websites simpler and more maintainable and may just have received too little attention. (Which was certainly due to lack of support, but is generally not the first and only time this has happened.) How can outside developers best make and support the case? I suppose the most effective way was to somehow convince another vendor to implement the header (those here involved with Chrome, what would tip the scale?), but do you see additional options that could also help? PS. |
Could you please elaborate on how this feature would do that? What would it enable you to do that is not possible today?
An actual strong use-case that this feature would enable would be a good start. |
I thought the way this works in Firefox is that there is a shared processing model so it would end up being more work to support some And it is somewhat nice for styling arbitrary documents, including XML, plain text, and media. |
That's not the case in neither Blink nor WebKit AFAIK. So supporting this would require someone explicitly devoting time to implement and ship the feature.
Yeah, that doesn't sound to me like a strong motivator for someone to implement. |
Sure, and you'll have that cost each time you add something new to |
One important use case for applying the IMHO, this is a niche feature which would be used mostly by developers and for developers, but it's an important one. |
@yoavweiss Do you know how hard it would be to implement this in Blink? Should we maybe just do it? It might not be a huge priority, but there might not be a huge reason not to do it. I'm not sure. |
I think The main benefit seems to be ease of maintenance of CSS references. To an extent, that easier maintenance is even automatically enforced (because several types of such updates would need to happen by changing the Its main use case, in my eyes, are large collections of documents, meaning large content sites. Now, these points can certainly be attacked (HTML payload decreases but HTTP header payload increases, or a single style sheet ref in a single server config being no improvement to a single style sheet ref in a single site template). Still, overall —A frank side note: I’m biased because a huge fan of this option. I love HTML code like the one in https://hell.meiert.org/temp/link/ (just some fooling around—obviously, use Firefox for styling), where all code except for the doctype relates to structure, as pure as one might wish HTML to be. However, I also realize how our field has changed a lot, so that I wouldn’t bet on broad adoption even when there was broad support. Still—for HTML optimization, in my mind, it’s a fantastic feature, and I keep seeing use cases for it. |
It actually applies to most non-HTML documents renderable by the browser: images, video, audio, plain text, PDFs. All of these could be styled through CSS within the browser using a Link header. If I link to an MP4, it will play in the browser inside an implied |
I suggest to start with spec'ing the currently implemented common denominator - Once this is in place, we can incrementally and optionally add more things:
|
Preload links based on link headers, some of them on document creation, and the rest (viewport-dependant ones) when response chunks start arriving. This can be used as an infra for early-hints and other link types. Conforms to the current common denominator of implementations. See whatwg#4224
Preload links based on link headers, some of them on document creation, and the rest (viewport-dependant ones) when response chunks start arriving. This can be used as an infra for early-hints and other link types. Conforms to the current common denominator of implementations. See whatwg#4224
Preload links based on link headers, some of them on document creation, and the rest (viewport-dependant ones) when response chunks start arriving. This can be used as an infra for early-hints and other link types. Conforms to the current common denominator of implementations. See whatwg#4224
Previously, Link header processing was almost entirely unspecified. This gives it a full processing model; currently it only processes preload Link headers, but in the future it can be extended to others. See #4224. Notably, this splits up processing of preload Link headers, some at document creation time, and the rest (viewport-dependent ones) when response chunks start arriving. Closes w3c/preload#148.
Previously, Link header processing was almost entirely unspecified. This gives it a full processing model; currently it only processes preload Link headers, but in the future it can be extended to others. See whatwg#4224. Notably, this splits up processing of preload Link headers, some at document creation time, and the rest (viewport-dependent ones) when response chunks start arriving. Closes w3c/preload#148.
@noamr, do you think there's anything left for this? Maybe only things that are tracked in other issues? We could spin off a separate "implementer interest needed" issue for tracking rel=stylesheet support, in particular. |
Yes sounds good |
Closes #4224. That issue was about the general lack of specification for the Link header, which has been resolved. #8741 tracks potentially adding Link header support for rel=stylesheet, but there's no need to retain notices in the spec about the possibility of this nonstandard feature. (The note was also quite incomplete, as it didn't talk about things like the cascade, document.styleSheets, etc.)
This adds "has `Link` processing" to the link types table, which currently only has "Yes" values for preload and preconnect. Closes #4224, and removes the reference to it in the spec. That issue was about the general lack of specification for the Link header, which has been resolved. #8741 tracks potentially adding Link header support for rel=stylesheet, but there's no need to retain notices in the spec about the possibility of this nonstandard feature. (The note was also quite incomplete, as it didn't talk about things like the cascade, document.styleSheets, etc.)
This adds "has `Link` processing" to the link types table, which currently only has "Yes" values for preload and preconnect. Closes whatwg#4224, and removes the reference to it in the spec. That issue was about the general lack of specification for the Link header, which has been resolved. whatwg#8741 tracks potentially adding Link header support for rel=stylesheet, but there's no need to retain notices in the spec about the possibility of this nonstandard feature. (The note was also quite incomplete, as it didn't talk about things like the cascade, document.styleSheets, etc.)
Processing
Link
headers states "These headers are to be processed according to the rules given in the relevant specifications" and that "Registration of relation types in HTTPLink
headers is distinct from HTML link types, and thus their semantics can be different from same-named HTML types".However, Web Linking states "It is semantically equivalent to the
<LINK>
element in HTML", so it seems that the specs are sort of pointing at each other. Since Web Linking claims they are semantically equivalent to the<LINK>
element, we should at least point to the obtain the resource in HTML. I imagine to be more formal maybe should define a collection of the givenLink
headers that we can "obtain" before parsing the document?Furthermore there are some processing bits that are relevant for
Link
headers that are not necessarily a concern for normal<link>
processing. GenerallyLink
headers can be fetched immediately, however some headers require viewport information that might not be available when the headers arrive (and would otherwise be fetched):Link
headers withmedia
attributemedia
attribute helps determine whether a rel=stylesheet is script-blocking or notLink
headers withimagesrcset
andimagesizes
attributes (/cc @irori @kinu ran into this when implementing also cc @yoavweiss )Implementers will need to defer the fetching of these
Link
headers until the viewport info is available (Chrome waits until the first chunk of the document is parsed IIUC) so I think it might be nice to indicate this in the spec in some way.The text was updated successfully, but these errors were encountered: