Origem
O conteúdo de origem é definido pelo esquema (protocolo), host (domínio), e porta da URL usada para acessá-lo. Dois objetos tem a mesma origem somente quando o esquema, host, e porta batem.
Algumas operações são restritas para conteúdos de mesma origem, e essa restrição pode ser ultrapassada usando CORS.
Exemplos de mesma origem
http://example.com/app1/index.html http://example.com/app2/index.html |
Mesma origem pois possuem o mesmo esquema (http ) e mesmo host (example.com ) |
---|---|
http://Example.com:80 http://example.com |
Mesma origem pois o servidor entrega conteúdo HTTP através da porta 80 por padrão. |
Exemplos de origens diferentes
http://example.com/app1 https://example.com/app2 |
Esquemas diferentes |
---|---|
http://example.com http://www.example.com http://myapp.example.com |
Hosts diferentes |
http://example.com http://example.com:8080 |
Portas diferentes |
Aprenda mais
Veja Same-origin policy para mais informações.