cnighswonger
Posts: 60
Joined: Fri Dec 07, 2012 1:28 pm

Data from csvURL not loading

Very simply:

This works: https://jsfiddle.net/gh/get/library/pur ... vedata-csv

This does not: https://jsfiddle.net/tsyvp9dL/1/

Any ideas what I am missing or doing wrong?

Chris
cnighswonger
Posts: 60
Joined: Fri Dec 07, 2012 1:28 pm

Re: Data from csvURL not loading

Maybe something about the way the server is serving up the csv is wrong?

Even a subset of the data from the working demo, when moved to my remote server does not work:

https://jsfiddle.net/tsyvp9dL/3/

:?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Data from csvURL not loading

Hi cnighswonger,

Thanks for contacting us with your question.

As you can see in the console there is a problem with CORS. I will take a look into that issue and get back to you with answer asap.

Regards!
Mateusz Bernacik
Highcharts Developer
cnighswonger
Posts: 60
Joined: Fri Dec 07, 2012 1:28 pm

Re: Data from csvURL not loading

mateusz.b wrote: Thu Jan 20, 2022 8:34 pm As you can see in the console there is a problem with CORS.
Actually... no, I can't see it in the console.
Screenshot 2022-01-20 at 15-47-49 Highcharts Demo - JSFiddle - Code Playground.png
Screenshot 2022-01-20 at 15-47-49 Highcharts Demo - JSFiddle - Code Playground.png (6.58 KiB) Viewed 411 times
Neither can I see a CORS issue in my local FF console.
mateusz.b wrote: Thu Jan 20, 2022 8:34 pm I will take a look into that issue and get back to you with answer asap.
Thanks for looking!
cnighswonger
Posts: 60
Joined: Fri Dec 07, 2012 1:28 pm

Re: Data from csvURL not loading

Ahh.... If I use my local FF console whilst running the fiddle, I do see the CORS error... (The fiddle console does not show much.)

However, using the local FF console whilst working on my app, I do not see the CORS error...
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Data from csvURL not loading

cnighswonger,

At this point I'm pretty sure that fiddle can't get your data because of your CORS settings. Most likely you don't see these errors in console during working on your app, because your development environment runs under the same domain and CORS hearders aren't required. If that is the case, then frankly speaking the problem is not related to Highcharts and goes beyond scope of our support, so I can't help too much, but I would suggest you reading this: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
Next thing I would suggest you to do, is to set this in your headers:

Code: Select all

Access-Control-Allow-Origin: *
It allows your resources to be accessed by any origin. I think it should help with the fiddle. Later you can set more strict rules.

Let me know if it helped.
Regards!
Mateusz Bernacik
Highcharts Developer
cnighswonger
Posts: 60
Joined: Fri Dec 07, 2012 1:28 pm

Re: Data from csvURL not loading

The problem is larger than the fiddle unfortunately. However in any case, the fiddle should not have CORS issues with non-highsoft resources I would think.

I'll post a follow-up question in a bit addressing the problem that led me to the fiddle.

Thanks again for your help!
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Data from csvURL not loading

Waiting for your results and questions. Just to be on the same page, it is not like the fiddle has a problem with non-highcharts resources. That's how CORS work in general and you can't access any data if these settings on any server that you want to reach, don't allow you to do so. In case of Highcharts resources, you can access the data, because these settings allow you to.
Mateusz Bernacik
Highcharts Developer
cnighswonger
Posts: 60
Joined: Fri Dec 07, 2012 1:28 pm

Re: Data from csvURL not loading

mateusz.b wrote: Thu Jan 20, 2022 11:24 pm Next thing I would suggest you to do, is to set this in your headers:

Code: Select all

Access-Control-Allow-Origin: *
It allows your resources to be accessed by any origin. I think it should help with the fiddle. Later you can set more strict rules.
Adding this directive to .htaccess on my public web server did fix the issue with the fiddle.

Kind regards,
Chris
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Data from csvURL not loading

Hi Chris,

Glad to hear it works. In case of any further questions feel free to contact us again.

Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”