Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Multiple fallback URLs and interaction with CORS #76

@bicknellr

Description

@bicknellr

@hiroshige-g found these:

The crossorigin attribute allows the user to control how a request is made and how it is interpreted when received. When paired with multiple URL fallbacks, if CORS failures are considered a condition for falling back to the next URL, then it is not true that a single import: URL - even within the same scope - maps to a single, unique network URL.

For example, given this HTML:

<img id="A" src="import:some-image">
<img id="B" src="import:some-image" crossorigin>

If the import map controlling the scope that these <img>s both use for mapping the src attribute specifies that import:some-image should map to these network URLs: [https://example.com/image-a.jpg, https://example.com/image-b.jpg], and https://example.com/image-a.jpg does not have a compatible value for Access-Control-Allow-Origin, then #A would result in import:some-image mapping to https://example.com/image-a.jpg and #B would result in import:some-image mapping to https://example.com/image-b.jpg.


Multiple fallback URLs and CORS also means it's not possible to implement an "import.resolve" API that allows the user to map import: URLs to network URLs themselves because the CORS issue described above means that the context in which a particular URL would be used determines whether or not fallback would happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions