-
Notifications
You must be signed in to change notification settings - Fork 211
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
Request: remove same origin requirement for API images #26
Comments
I have a use case that requires this and it would be very lovely for the images to be accessible in this way |
It seems CORS headers have been removed from images. Behold your image cc @spencerk |
@stephenhmarsh Is it possible this has been regressed? We're trying to load images using Flutter client, and getting this error: |
Here's an example of Using the URL above ( |
@stephenhmarsh @spencerk Thanks for looking into this! Here is an interactive example, one button downloads from unsplash.com which works, the other downloads from metmuseum.org and fails: <button onclick="downloadImage('https://images.metmuseum.org/CRDImages/ep/original/DT8844.jpg')">Download MET Image</button>
<button onclick="downloadImage('https://images.unsplash.com/photo-1512813389649-acb9131ced20')">Download Unsplash Image</button>
<script>
function downloadImage(url) {
fetch(url)
.then(resp => resp.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
var fileName = url.split(/[#?]/)[0].split('/').pop();
a.download = fileName;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
})
.catch((e) => alert('An error occurred while downloading the image.\n' + e));
}
</script> |
This restriction limits client side apps attempting to make use of the https://metmuseum.github.io API
The text was updated successfully, but these errors were encountered: