Reputation: 11
I have livescore website and it shows data of each day games for a week . The whole week games are show but today games are not .
I got this error in my console in both browsers chrome and firefox:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://alpha.fractalsciences.com:8080/databusiness/categories?referer=http://www.example.com/. This can be fixed by moving the resource to the same domain or enabling CORS.
I have the same data in another website it called very smoothly and nothing wrong with it .
NOTE: I do not know what is alpha.fractalsciences.com
it is not my domain and i do not use it in my codes I do not know why the console shows me this domain ???
Even I enabled the CORS by adding header('Access-Control-Allow-Origin: *');
to the first line of my index.php
but still getting the same problem.?? Is there any way to find out why my data stop showing eventhought I reach it by http as a plain XML ??? Is there any suggestion to deal with this?
Upvotes: 0
Views: 152
Reputation: 32350
If you want to allow access to something, you need to own it.
The CORS header to allow access must be sent from the server http://alpha.fractalsciences.com:8080/databusiness/categories
not from your client. Because the Access-Control-Allow-Origin
is a response header
, not a request header
.
If the owner of the domain doesn't allow you to read from it via ajax, you have no chance to read it client-side. You can try to read the data through PHP (serverside) tho because you can decide to circumvent this kind of protection.
Like Juhana said, you should worry about requests you did not implement. You should investigate all of the source files yo use. The console usually displays where such calls origin from.
Upvotes: 1