When doing a cross domain HTTP
request from a Javascript client, like JQuery (from a client browser). In the receiving end, will it be able to point out where the Javascript request came from?
Example, I have a site, and it loads up a Javascript that will call a web service, say foo.com/someapi
When the API receives the request, what will it be able to get the origination host. Say my site is bar.com
and when I access bar.com/index.html
it will load up the page and fire up the javascript HTTP request to foo.com/someapi
In the client request there was no server side request involved its pure Javascript.
Furthermore, what if the call is executed from a development environment, like localhost what will be the hostname
that the receiving foo.com/someapi
will get?
What does a browser do when doing HTTP request from Javascript:
- In a public domain site
- And with a localhost site