Glossary
Same-origin policy
Definition
Same-origin policy: The browser security rule that lets scripts read data only from their own origin (the same scheme, host and port), isolating content from different origins unless the other origin opts in through CORS.
Also known asSOPsame origin policyorigin policy
In short
The same-origin policy is the browser rule that lets a page read only data from its own origin, meaning the same scheme, host and port. A page on one site can send requests to another, but it can't read the responses, the other page's contents or its storage unless that site allows it through CORS. Cookies follow an older, looser rule scoped by domain.
Key takeaways
- An origin is the scheme, host and port together. Change any one and it's a different origin.
- The policy restricts reading across origins, not sending requests, which is why CSRF exists.
- CORS is how a server opts in to sharing its responses with another origin.
- Cookies are scoped by domain, so a cookie for example.com can reach every subdomain.
- Same site is a broader grouping than same origin, used by SameSite cookies.
Last reviewed 4 December 2026 by Foxcolab Team
The same-origin policy is the browser rule that lets a web page read data only from its own origin. An origin is the scheme, host and port of a URL: RFC 6454 says "two URIs are part of the same origin" if they "have the same scheme, host, and port," and that browsers "isolate content retrieved from different origins." The HTML Standard calls origins "the fundamental currency of the web's security model."
What counts as the same origin#
Compared with https://app.example.com/page:
| URL | Same origin? | Why |
|---|---|---|
https://app.example.com/settings | Yes | Only the path differs |
http://app.example.com/page | No | Different scheme |
https://api.example.com/page | No | Different host |
https://app.example.com:8443/page | No | Different port |
What it blocks, and what it doesn't#
A script on evil.example can't read your inbox at mail.example.com with fetch, can't look inside a frame showing that site, and can't open its local storage. What the policy doesn't stop is sending. A page can still submit a form to another origin, load its images or include its scripts. That gap is why cross-site request forgery exists, and why cross-site scripting is so damaging: injected code runs inside the origin, where the rule doesn't apply.
When a server wants to share its responses, it opts in with CORS. The Fetch Standard says the CORS protocol exists "to allow sharing responses cross-origin," with Access-Control-Allow-Origin indicating "whether the response can be shared."
Where cookies differ#
Cookies "pre-date the modern web origin concept," RFC 6454 notes, and follow their own rules. A cookie set with Domain=example.com is sent to every subdomain on any port, and over plain HTTP too unless it's marked Secure. The HTML Standard's "same site" groups origins by scheme and registrable domain, which is the boundary SameSite cookies use. It's broader than same origin, and the spec recommends same-origin checks wherever possible.
In Foxcolab#
Each Foxcolab app runs at its own origin, such as mail.foxcolab.com, drive.foxcolab.com and docs.foxcolab.com, so under the same-origin policy a script on one can't read another app's pages or browser storage. Sign-in is the deliberate bridge: Foxcolab's sign-in cookies are set for the whole foxcolab.com domain, which is how one sign-in covers every app. Drive, Docs, Sheets, Notes, Whiteboard and Forms add a Content Security Policy that also limits which origins each page may connect to. To use more than one account in the same browser, see switch between Foxcolab accounts.
Keep exploring
Related terms
- Cross-site request forgery (CSRF)Cross-site request forgery tricks your browser into sending a request to a site where you're signed in, so the site acts on it as if you meant it. Here's how it works and how sites stop it.
- Cross-site scripting (XSS)Cross-site scripting lets an attacker run their own script inside a trusted website, in other people's browsers. Here are the three types, an example and the defenses that work.
- Content Security Policy (CSP)A Content Security Policy tells the browser which scripts, frames and connections a page may use, so an injected script doesn't run. Here's a strict policy explained line by line.
- Session cookieA session cookie is either a cookie that disappears when the browser session ends or the cookie that keeps you signed in. Here's what each attribute does and why stolen ones matter.
- ClickjackingClickjacking hides a real website inside an invisible frame and lines up its buttons under your clicks. Here's how it works and the headers that stop it.
Where Foxcolab uses it

Foxcolab
Private work tools, without the ads.
Mail, files, documents, spreadsheets and meetings in one account. Files, documents and spreadsheets are end-to-end encrypted.