Skip to content
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

Support for loading from URI without URL #179

Closed
JamesNJep opened this issue Sep 23, 2019 · 3 comments
Closed

Support for loading from URI without URL #179

JamesNJep opened this issue Sep 23, 2019 · 3 comments

Comments

@JamesNJep
Copy link

Alot of websites use the same libraries like JQuery, and so we request the file for the file from the CDN so that the CDN can cache the file once and we save time and bandwidth when loading the file. To make sure the file is the file we are expection we can specify a URI to make sure the file is the correct file.

Could we instead specify only a URI, and then the browser could check all it's cached files to see if the file exists and then only try to load the file from a URL if the file wasn't cached?

@domenic
Copy link
Collaborator

domenic commented Sep 23, 2019

It's unclear what this has to do with import maps. You can already specify URLs in import statements. (However, note that cross-site caching seems to be on its way out.)

I'm also unclear what your title is about; on the web, URI is just a deprecated legacy term for URL.

I'll close this, although happy to reopen if some connection to import maps is found.

@domenic domenic closed this as completed Sep 23, 2019
@JamesNJep
Copy link
Author

Sorry for the bad explenation your right URI was the wrong term.
What I mean is the file hash, when you set a Content Security Policy on a site you can require a hash when specifiying the file to load.
My understanding of the the import map feature is that you would be able to list fall backs for the requested file. SO if it can't load the file from the first URL it will try the next URL.
What I would like to be able to do is just say I need a file that matches a hash and that I don't care where the file is loaded from, so if the browser has already downloaded and cached. I will just use the files that matches the hash I have specified and not need to request to download the file again.

For example if I specify a hash and then two URL's but the browser already has the file cahed from the second URL, instead of trying to request the file from the first URL and then trying the second URL after the first fails to load, could the browser see that the second URL is already cached and matches the hash and load that file without trying the first URL and waiting for it to fail.
<script type="importmap"> { "imports": { "example": ["sha256-blLDIhKaPEZDhc4WD45BC7pZxW4WBRp7E5Ne1wC/vdw" ,"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js" ,"https://code.jquery.com/jquery-3.4.1.js"] } } </script>

@domenic
Copy link
Collaborator

domenic commented Sep 24, 2019

My understanding of the the import map feature is that you would be able to list fall backs for the requested file. SO if it can't load the file from the first URL it will try the next URL.

This was removed in #176.

What I would like to be able to do is just say I need a file that matches a hash and that I don't care where the file is loaded from, so if the browser has already downloaded and cached. I will just use the files that matches the hash I have specified and not need to request to download the file again.

Unfortunately this model has serious privacy issues. See https://hillbrad.github.io/sri-addressable-caching/sri-addressable-caching.html

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

No branches or pull requests

2 participants