12 KiB
| title | chunk | source | category | tags | date_saved | instance |
|---|---|---|---|---|---|---|
| Origin - Glossary | MDN | 1/3 | https://developer.mozilla.org/en-US/docs/Glossary/Origin | reference | web, html, css, javascript, documentation | 2026-05-05T05:39:30.254380+00:00 | kb-cron |
MDN HTML HTML: Markup language
HTML reference
HTML guides
Markup languages
CSS reference
CSS guides
Layout cookbook
JavaScriptJS JavaScript: Scripting language
JS reference
JS guides
Web APIs Web APIs: Programming interfaces
Web API reference
Web API guides
- Using the Web animation API
- Using the Fetch API
- Working with the History API
- Using the Web speech API
- Using web workers
Technologies
Topics
Learn Learn web development
Frontend developer course
- Getting started modules
- Core modules
- MDN Curriculum
- Check out the video course from Scrimba, our partner
Learn HTML
Learn CSS
Learn JavaScript
Tools Discover our tools
About Get to know MDN better
Origin
Web content's origin is defined by the scheme (protocol), hostname (domain), and port of the URL used to access it. Two objects have the same origin only when the scheme, hostname, and port all match. Some operations are restricted to same-origin content, and this restriction can be lifted using CORS.
In this article
Opaque origin
An opaque origin is a special type of browser-internal value that obscures the true origin of a resource (opaque origins are always serialized as null). They are used by the browser to ensure resource isolation as they are never considered equal to any other origin — including other opaque origins.
Opaque origins are applied in cases where the true origin of a resource is sensitive, cannot be safely used for security checks, or does not exist. A resource with an opaque origin will have its Origin HTTP header in requests set to null. It will also fail same-origin checks with any other resource, and hence be restricted to only those operations available to cross-origin resources.
Common cases where opaque origins are used include:
- A document within an iframe that has the sandbox attribute set, and does not include the
allow-same-originflag. file:URLs are usually treated as opaque origins so that files on the file system cannot read each other.- Documents created programmatically using APIs like
DOMImplementation.createDocument().
Examples
These are same origin because they have the same scheme (http) and hostname (example.com), and the different file path does not matter:
http://example.com/app1/index.htmlhttp://example.com/app2/index.html
These are same origin because a server delivers HTTP content through port 80 by default:
http://example.com:80http://example.com
These are not same origin because they use different schemes:
http://example.com/app1https://example.com/app2
These are not same origin because they use different hostnames:
http://example.comhttp://www.example.comhttp://myapp.example.com
These are not same origin because they use different ports:
http://example.comhttp://example.com:8080
See also
- Same-origin policy
- Related glossary terms:
- HTML specification: origin