Published Nov 26, 2022
[
 
]
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.
These are same origin because they have the same scheme (http
) and hostname
(example.com
), and the different file path does not matter:
These are same origin because a server delivers HTTP content through port 80 by default:
These are not same origin because they use different schemes:
These are not same origin because they use different hostnames:
These are not same origin because they use different ports: