我通过http://en.wikipedia.org/wiki/Same-origin_policy对同源政策产生了一些疑问。假设我点击了一个 URL http://myApp1:8080/myApp1
,然后在浏览器上看到了 welcome.html。现在我尝试将welcome.html 表单(或尝试进行ajax 调用)提交给不同的应用程序,即http://myApp2:9001/myApp2
。此调用能否访问 myApp2 服务器。根据我的理解,由于同源策略,浏览器本身不会将此调用发送到 myApp2。那是对的吗?
问问题
38 次
1 回答
0
Will this call be able to hit myApp2 server.
Yes
As per my understanding browser itself will not send this call to myApp2 because of Same Origin policy. Is that correct?
The Same Origin Policy prevents JavaScript on one origin from reading an HTTP response from another origin. It doesn't prevent the request from being sent (except when the situation triggers a preflight request).
于 2013-09-29T18:19:30.753 回答