This confuses me a lot. Let's say I have 2 tabs open in my browser, one on http://aaa.com
and another on http://bbb.com
.
Let's say I make a request
$ajax({
method : 'POST',
url : 'http://aaa.com/SomeAction',
...
});
from the JavaScript console of my browser. The way I understand cross-origin policy is that the server only allows that request to happen if the JS console I typed it into was the one in the tab for http://aaa.com
. But how does the server know that? Does my browser send it a header that tells it where the request is coming from?