Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

13
  • How do i set the origin if the origin is not the same? Commented Jun 23, 2018 at 21:12
  • Unfortunately or fortunately we can't set the origin. If you need to access to document of other origin, there are two ways, perform an ajax GET/POST request only if server have Access-Control-Allow-Origin: yourDomine ( or *) developer.mozilla.org/es/docs/Web/HTTP/Headers/… OR perform a GET/POST from server side Commented Jun 23, 2018 at 21:18
  • i know how to configure an XHR but i don't know how to access the Access-Control-Allow-Origin header... Commented Jun 23, 2018 at 21:24
  • it's a server side header, if you don't control the server or this header is not present, the only way is perform a GET/POST from server side, not a browser. If you control the server it depends of the server code, but it's really easy. Commented Jun 23, 2018 at 21:29
  • Example in php: header('Access-Control-Allow-Origin: *'); Commented Jun 23, 2018 at 21:32