Apparently, I have completely misunderstood its semantics. I thought of something like this:
- A client downloads javascriptJavaScript code MyCode.js from
http://siteA- the origin. - The response header of MyCode.js contains Access-Control-Allow-Origin:
http://siteB, which I thought meant that MyCode.js was allowed to make cross-origin references to the site B. - The client triggers some functionality of MyCode.js, which in turn make requests to
http://siteB, which should be fine, despite being cross-origin requests.
Well, I am wrong. It does not work like this at all. So, I have read Cross-origin resource sharingCross-origin resource sharing and attempted to read Cross-Origin Resource Sharing in w3c recommendationCross-Origin Resource Sharing in w3c recommendation.
One thing is sure - I still do not understand how am I am supposed to use this header.
I have full control of both site A and site B. How do I enable the javascriptJavaScript code downloaded from the site A to access resources on the site B using this header?
P.S.
: I do not want to utilize JSONPJSONP.