Post
Topic
Board Project Development
Re: Bitcoin block data available in CSV format
by
bitmover
on 17/12/2020, 22:55:47 UTC
Hello LoyceV,

I have been working with your CSV and noticied that your server is blocking cross-origin requests (CORS). I don't know if that is your intention or not. My server was blocking CORS as well by default.

I cannot make simple requests like this one, that they will be blocked:
Code:
$.ajax({
    url: 'https://loyce.club/blockdata/blockdata.lastday.txt',
    dataType: 'text',
  })

You can make tests here. This is a public library for CSV parsing. They have a demo, and if you try to load your CSV it will show this

"Access to XMLHttpRequest at 'https://loyce.club/blockdata/blockdata.lastday.txt' from origin 'null' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://bitcointalk.org' that is not equal to the supplied origin."

I solved that error in my server just by adding this line to my .htaccess file.
Code:
Header set Access-Control-Allow-Origin "*"

You can read more here:
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSAllowOriginNotMatchingOrigin
https://stackoverflow.com/questions/13421463/htaccess-access-control-allow-origin