CORS not set, can't access JSON in Chrome
No description provided.
Comments (10)
-
-
The Simple API will return JSONP if the parameter
&callback=mycallback
is appended to the query, I believe this is the standard way of addressing this issue.I don't know why the parameter
&_=1406801162041
is appended to the query, I don't think it matters because I believe the Simple API will silently ignore unrecognised parameters. -
reporter This doesn't help when the request contains non-JSON material, of course.
-
_=<randomnumber>
is a semi-standard way of defeating broken caches. -
As per the error message, we need to add an Access-Control-Allow-Origin header.
For the JSON API on the platform we add one like this:
Access-Control-Allow-Origin: *
This is standard practice for APIs that do not require a login (most of them).
-
@StevenMaude @drj I think I fixed this but I don't know how to test it
-
@ian_hopkinson I tried the queries:
https://newsreader.scraperwiki.com/summary_of_events_with_actor/page/1?uris.0=dbpedia:John_Swofford&output=json and https://newsreader.scraperwiki.com/summary_of_events_with_actor/page/1?uris.0=dbpedia:John_Swofford&output=html
in Chromium and they seemed to load OK.
Not sure what I'd expect to see if they didn't. (I checked in developer console.)
-
- changed status to on hold
-
The convincing demo that this was fixed would be to try out Sophie's code on the Mac
-
I can't reproduce on Firefox or Chromium, so I'm going to assume that the header change fixed it. If anyone else has this problem, we'll reopen the issue.
- Log in to comment
XMLHttpRequest cannot load https://newsreader.scraperwiki.com/summary_of_events_with_actor/page/1?uris.0=dbpedia:Wayne_Rooney&output=html&_=1406801162041. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.