Simple JavaScript requests
GET missing Access-Control-Allow-Origin header
Summary
JavaScript code can make a cross-origin GET request.
The response must include an Access-Control-Allow-Origin
header, otherwise the browser discards it and returns an error to the JavaScript code.
Instructions
- Hit green button below and see that request fails
- Press F12 to open browser Developer Tools
- Open Console tab and see error message “No ‘Access-Control-Allow-Origin’ header is present”
View source on GitHub | Created by Tom Gregory