HTML5 Cross-Origin Resource Sharing (CORS)

What is CORS?

  • It is abbreviated as Cross-origin resource sharing (CORS).
  • It is a mechanism which allows the restricted resources from another domain in the web browser.

CORS request

The Httprequest2 object is used by the browsers like Chrome, Safari, Firefox. Internet Explorer uses the XdomainRequest object.

Event Handlers in CORS

Event HandlersDescription
onloadstartIt will start the request.
onprogressIt will load and send the data.
onabortIt aborts the request.
onerrorIt shows that the request is failed.
onloadIt requests the load successfully.
ontimeoutIt shows that there occurred a timeout before the request could be completed.
onloadendWhen the request is completed it can either be successful or a failure.