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.
Loading...
Related Quiz
- The block of code inside ______ will be executed if its condition is true and all preceding conditions are false.
- An async function can contain an await expression that pauses the execution of the async function and waits for the passed _______ to resolve or reject.
- The pop() method removes the last element from an array and returns _______.
- You're debugging a JavaScript application and notice unexpected behavior in the manipulation of an array. The items are not being removed correctly using a method, and it turns out the array is not being modified at all. Which array method might be mistakenly being used?
- To select elements with a specific class name, you should use the __________ method.