Chapter 2. Making CORS requests

This chapter covers

  • Which browsers support CORS
  • How to use the XMLHttpRequest object to make CORS requests
  • How to use the XDomainRequest object in Internet Explorer 8 and 9
  • How to load cross-origin images in a canvas element
  • How to make CORS requests from jQuery

A CORS request consists of two sides: the client making the request, and the server receiving the request. On the client side, the developer writes JavaScript code to send the request to the server. The server responds to the request by setting special CORS-specific headers to indicate that the cross-origin request is allowed. Without both the client’s and the server’s participation, the CORS request will fail.

This chapter focuses on how to make ...

Get CORS in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.