I’m working on a React app using a Google Drive link as the src for an image. The link has this format:
https://drive.google.com/uc?export=view&id={{imageId}}
It was working fine, but it suddenly stopped working. The link is still public, and I’ve tested viewing the image in different browsers and using incognito mode.
When I make a GET request to the link from the React app, I receive a 403 error. Also, on chrome I see this warning:
Error with Permissions-Policy header: Unrecognized feature: ‘ch-ua-form-factor’.
Any hints on how to resolve this and why it suddenly stopped working?
I tried with other images, setting policy headers using meta tags in index.html, and also setting referrerPolicy="no-referrer" on the image, but still not working.
2
Answers
Related to this quesion, just enter your image ID into this link instead:
I had the same problem.
I have an application developed in React and it suddenly stopped working (I don’t know why).
SOLUTION:
If you are importing the image from Google Drive in this way:
<img src={
https://drive.google.com/uc?export=view&id=${IMAGE_ID}
} alt={NAME}/>Import it in this other way:
<img src={
https://drive.google.com/thumbnail?id=${IMAGE_ID}
} alt={NAME}/>I leave you the function that I use to normalize the Google Drive link and leave it correctly ready to use in the application:
I hope it helps you!