Which API allows you to make non-simple requests to another domain in JavaScript, considering the Same-Origin Policy?

  • XMLHttpRequest
  • JSONP (JSON with Padding)
  • CORS (Cross-Origin Resource Sharing)
  • WebSocket
CORS (Cross-Origin Resource Sharing) is the API that allows you to make non-simple requests (such as those with custom headers or methods) to another domain in JavaScript while considering the Same-Origin Policy. XMLHttpRequest is an older alternative but has limitations compared to CORS. JSONP is a workaround technique, not an API, and WebSocket is used for full-duplex communication, not for cross-origin requests.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *