Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1132005 of Origin

  • Revision slug: Glossary/Origin
  • Revision title: Origin
  • Revision id: 1132005
  • Created:
  • Creator: teoli
  • Is current revision? Yes
  • Comment

Revision Content

The origin of some web content is defined by the scheme (protocol), host (domain), and port of the URL used to access it. Two objects have the same origin only when the scheme, host, and port match.

Some operations are restricted to same-origin content, and this restriction can be lifted using CORS.

Examples of same origin

https://example.com/app1/index.html
https://example.com/app2/index.html
same origin because same scheme (http) and host (example.com)
https://Example.com:80
https://example.com
same origin because a server delivers HTTP content through port 80 by default

Examples of different origin

https://example.com/app1
https://example.com/app2
different schemes
https://example.com
https://www.example.com
https://myapp.example.com
different hosts
https://example.com
https://example.com:8080
different ports

Learn more

​See Same-origin policy for more information.

Revision Source

<p>The origin of some web content is defined by the <em>scheme</em> (protocol), <em>host</em> (domain), and <em>port</em> of the URL used to access it. Two objects have the same origin only when the scheme, host, and port match.</p>

<p>Some operations are restricted to same-origin content, and this restriction can be lifted using <a href="/en-US/docs/Glossary/CORS">CORS</a>.</p>

<h2 id="Examples_of_same_origin">Examples of same origin</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <td style="width: 50%;"><code>https://example.com/app1/index.html</code><br />
    <code>https://example.com/app2/index.html</code></td>
   <td style="width: 50%;">same origin because same scheme (<code>http</code>) and host (<code>example.com</code>)</td>
  </tr>
  <tr>
   <td style="width: 50%;"><code>https://Example.com:80</code><br />
    <code>https://example.com</code></td>
   <td style="width: 50%;">same origin because a server delivers HTTP content through port 80 by default</td>
  </tr>
 </tbody>
</table>

<h2 id="Examples_of_different_origin">Examples of different origin</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <td style="width: 50%;"><code>https://example.com/app1</code><br />
    <code>https://example.com/app2</code></td>
   <td>different schemes</td>
  </tr>
  <tr>
   <td style="width: 50%;"><code>https://example.com</code><br />
    <code>https://www.example.com</code><br />
    <code>https://myapp.example.com</code></td>
   <td style="width: 50%;">different hosts</td>
  </tr>
  <tr>
   <td style="width: 50%;"><code>https://example.com</code><br />
    <code>https://example.com:8080</code></td>
   <td style="width: 50%;">different ports</td>
  </tr>
 </tbody>
</table>

<h2 id="Learn_more">Learn more</h2>

<p>​See <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript" title="/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript">Same-origin policy</a> for more information.</p>
Revert to this revision