--- title: Origin slug: Glossary/Origin translation_of: Glossary/Origin original_slug: Glossary/源 ---
Web内容的源由用于访问它的{{Glossary("URL")}} 的方案(协议),主机(域名)和端口定义。只有当方案,主机和端口都匹配时,两个对象具有相同的起源。
某些操作仅限于同源内容,而可以使用 CORS 解除这个限制。
http://example.com/app1/index.html http://example.com/app2/index.html |
same origin because same scheme (http ) and host (example.com ) |
http://Example.com:80 http://example.com |
same origin because a server delivers HTTP content through port 80 by default |
http://example.com/app1 https://example.com/app2 |
different schemes |
http://example.com http://www.example.com http://myapp.example.com |
different hosts |
http://example.com http://example.com:8080 |
different ports |
详细信息,请看同源策略。