Chapter 25: Same-Origin Policy and CORS
All web browsers enforce a set of security rules that protect users from unauthorized access to their data. One of the key security mechanisms is the so-called Same-Origin Policy. This policy prevents a web page from accessing content from a different origin (for example, a different domain, port, or protocol). Thanks to this policy, JavaScript running on one page cannot freely communicate with external servers, which helps prevent many types of attacks.