Foxcolab

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:

URLSame origin?Why
https://app.example.com/settingsYesOnly the path differs
http://app.example.com/pageNoDifferent scheme
https://api.example.com/pageNoDifferent host
https://app.example.com:8443/pageNoDifferent 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.

Create a free account.

Keep exploring

All terms

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.

Jump to