0

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?

  • 1
    possible duplicate of [Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at](http://stackoverflow.com/questions/24182259/cross-origin-request-blocked-the-same-origin-policy-disallows-reading-the-remot) – Marcin Orlowski Oct 08 '14 at 09:04
  • 1
    Alarm bells should be ringing right about now if a site you own is making calls to an external web site you know nothing about. First find out what's making those calls (see where the console error points to or search the page sources.) – JJJ Oct 08 '14 at 09:08

1 Answers1

1

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.

Daniel W.
  • 31,164
  • 13
  • 93
  • 151