🔐Same-Origin Policy (SOP)
Also known as Same Origin Policy, Web Origin, Origin (Web)
A browser rule. It stops one site from reading what another site sends.
Think of it like
Think of it like flats in one building. You can use your own rooms, but not walk into your neighbour's.
Example
Jack is logged in to his bank. A bad page in another tab tries to fetch his balance, but the browser will not let it read the reply.
Why it matters
It is the wall that keeps your open tabs from spying on each other. CORS is the door a site can open in it on purpose.
Definition
Common mistake
Key takeaways
- 1Scheme, host, port. All three must match.
- 2Reading is blocked. Other origins' replies stay hidden.
- 3CORS opens it. A site can allow named origins.