As far as I know, JSONP
support is no longer sought after but, as @docdem has checked it, CORS is allowed, no doubt. You don’t need to avoid it.
I saw this in the response, me too:
Access-Control-Allow-Origin: *
I tried a random &fmt=json
request from a random domain:
var xhr = new XMLHttpRequest();
xhr.open("get", "http://musicbrainz.org/ws/2/release/8152e1c7-d737-488c-a02b-a3ef10104580?inc=artists+labels+recordings+release-groups+media+artist-credits+annotation+url-rels&fmt=json", false);
xhr.send(null);
Request:
GET /ws/2/release/8152e1c7-d737-488c-a02b-a3ef10104580?inc=artists+labels+recordings+release-groups+media+artist-credits+annotation+url-rels&fmt=json HTTP/1.1
User-Agent: Opera/9.80 (Windows NT 5.1) Presto/2.12.388 Version/12.18
Host: musicbrainz.org
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: fr,en;q=0.9,vi;q=0.8,ja;q=0.7
Accept-Encoding: gzip, deflate
Referer: http://illustrated-db-discography.nl/Album.htm
Connection: Keep-Alive
Origin: http://illustrated-db-discography.nl
Response:
HTTP/1.1 200 OK
Date: Tue, 19 Apr 2016 16:32:09 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Keep-Alive: timeout=15
Server: nginx/1.4.6 (Ubuntu)
Access-Control-Allow-Origin: *
Content-Encoding: gzip
{"I am shortening": "the results, here ;)"}
You can manage the response in an event listener:
xhr.addEventListener("load", …
xhr.addEventListener("error", …
You can check many examples like RECORDING_LENGTH_COLUMN
in SUPER TURBO (current version).
Consider this error event listener, it took me about 10 503
errors before my first 200 OK
.
It’s a little different but it’s still a function that you can write as you wish… no ?