Open gonzaRey opened 6 years ago
I live the same problem myself.
I am using vuejs
@eKoopmans please help.
What browser are you using? I am having a similar issue in firefox specifically but not chrome. (both on latest version)
I using chrome and safari
Any fix for this issue? I'm experiencing this same problem😔
Anyone having this issue can use this workaround
toDataUrl = (url, callback) => { const xhr = new XMLHttpRequest(); xhr.onload = () => { const reader = new FileReader(); reader.onloadend = () => { callback(reader.result); }; reader.readAsDataURL(xhr.response); }; xhr.open('GET', url); xhr.responseType = 'blob'; xhr.send(); };
_renderImages(images) { const { classes } = this.props; return images.map((image, key) => { this.toDataUrl(image.name, (myBase64) => { }); return ( <img alt="" key={key} className={classes.image} src={image.name} /> ) }); }
before rendering images just convert that image into blob . It has worked in my case
There's no issue here, it's an expected CORS functionality. Just replace your image's URI accordingly.
Two things got me fixing this:
1) Allow CORS in your server. In my case I use AWS S3, so I went to configuration and there you have the instruction to activate it
2) Add a "crossorigin" attribute with a "*" value to your img html tags. I used javascript for this:
let imagenes = document.getElementsByTagName("img"); for (let i = 0; i < imagenes.length; i++) { imagenes[i].setAttribute("crossorigin", "*");
i had this issue then I converted images to Blob and this is only solution , if you are run time displying pdf then try
const file = image.target.files[0]
let blob= URL.createObjectURL(file);
or get blob from server side otherwise you'd end up getting CORS issues.
we are also having the same issue. Is there any workaround for this issue?
so this is my HTML
and my JS:
I am using angular 4.
as you can see on the setting I tried out everything that I have seen in the issues and in the documentation. added the proxy even when it is in the same filesystem as the image. Also, added the cors and the tainted properties. I have tried using them in a different order as well. plz help @eKoopmans