Forum Discussion

mappingsupport's avatar
mappingsupport
New member | Level 2
2 years ago
Solved

What link do I use to read a JPG with code?

I put a JPG on dropbox (in a subfolder) and I am trying to download that JPG using a javascript fetch command.  My code works fine with JPGs hosted on various other servers including Google Drive.

My javascript code is using this link:  https://www.dropbox.com/scl/fi/ea9go6nont63t556sy6o4/WA_Chiwaukum_big_open_topo.jpg?rlkey=m7girlv2c79sq98u0retjcs6e&dl=1

 

The purpose for downloading the JPG is so my code can use the cache API to save the JPG on the user's device.  This is all part of the GeoJPG web app I developed for offline maps.

 

If I enter the above link into a browser tab then I am invited to  download the JPG.  However, when I try to download the JPG content with my javascript then the following error messages show up in the browser's console.

 

Failed to load ‘https://www.dropbox.com/scl/fi/ea9go6nont63t556sy6o4/WA_Chiwaukum_big_open_topo.jpg?rlkey=m7girlv2c79sq98u0retjcs6e&dl=1’. A ServiceWorker passed a promise to FetchEvent.respondWith() that rejected with ‘TypeError: NetworkError when attempting to fetch resource.’.

 

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.dropbox.com/scl/fi/ea9go6nont63t556sy6o4/WA_Chiwaukum_big_open_topo.jpg?rlkey=m7girlv2c79sq98u0retjcs6e&dl=1. (Reason: CORS request did not succeed). Status code: (null).

 

What am I missing?

1 Reply

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!