Closed JamesNJep closed 4 years ago
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.
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>
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
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?