Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Usage example for crossorigin use in Link header. #64

Closed
jdalton opened this issue Sep 8, 2016 · 5 comments
Closed

Usage example for crossorigin use in Link header. #64

jdalton opened this issue Sep 8, 2016 · 5 comments
Assignees
Labels
Milestone

Comments

@jdalton
Copy link
Member

jdalton commented Sep 8, 2016

I noticed that prefetch can specify crossorigin attirbute when using the link tag. Could there also be an example of handling it with the Link: header.

A follow-up would be expanding on what are the accepted values of linkElement.crossOrigin=.... Is it just string values or will a boolean true or an empty string "" be treated as "anonymous"?

@yoavweiss
Copy link
Contributor

The crossorigin attribute on link elements is identical to other elements. For values see https://html.spec.whatwg.org/#cors-settings-attributes or https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes

Adding it as an attribute to headers is identical to other attributes: e.g.
Link: <https://example.com/logo-hires.jpg>; rel=prefetch; as=image; crossorigin
or
Link: <https://example.com/logo-hires.jpg>; rel=prefetch; as=image; crossorigin=anonymous

Do you think the spec is not clear enough on that front?

@jdalton
Copy link
Member Author

jdalton commented Sep 12, 2016

Ya, I eventually put it together looking at other blog posts / references. With CORS being its own header initially I wasn't sure if that would be tackled somewhere else.

@igrigorik igrigorik added this to the Level 1 milestone Oct 13, 2016
@staabm
Copy link

staabm commented Jan 17, 2018

was also searching exactly that and found the example here.

I guess it would also be helpful for others to have a crossorgin example in the spec.
(I searched the spec before finding this issue via google)

@yoavweiss
Copy link
Contributor

/cc @noamr - can you incorporate such an example into whatwg/html#7622 ?

@yoavweiss
Copy link
Contributor

The behavior of Link headers and crossorigin is now defined in https://html.spec.whatwg.org/#processing-link-headers
If there's a need to further document crossorigin specifically, the relevant MDN article is probably the best place.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants