发出跨域 Ajax 请求
Making Cross Domain Ajax Requests
比方说,我在 a.com 和 b.com 托管了 2 个 Web 服务器 b.com 不接受来自 a.com.
的跨域请求
我在浏览器的一个选项卡中打开了 http://a.com and in another tab i have opened http://b.com。
根据同源策略,下列哪项是正确的。
1) 来自 http://a.com using ajax I can make cross-domain GET and POST request to http://b.com but can not read the response from http://b.com
2) 来自 http://a.com using ajax I can make cross-domain GET and POST request to http://b.com and I can also read the response from http://b.com
3) 来自 http://a.com using ajax I can make cross-domain GET, POST, PUT, DELETE request to http://b.com but can not read the response from http://b.com
4) 来自 http://a.com using ajax I can make cross-domain GET, POST, PUT, DELETE request to http://b.com as well as read response from http://b.com
P.S。不期待任何关于 SOP 和 CORS 的讲座。请求简短而甜蜜的回答
唯一正确的答案是 1。仅仅因为 CORS preflight 请求 fails 在 3 和 4 上,所以实际请求甚至不会占用地点。
比方说,我在 a.com 和 b.com 托管了 2 个 Web 服务器 b.com 不接受来自 a.com.
的跨域请求我在浏览器的一个选项卡中打开了 http://a.com and in another tab i have opened http://b.com。
根据同源策略,下列哪项是正确的。
1) 来自 http://a.com using ajax I can make cross-domain GET and POST request to http://b.com but can not read the response from http://b.com
2) 来自 http://a.com using ajax I can make cross-domain GET and POST request to http://b.com and I can also read the response from http://b.com
3) 来自 http://a.com using ajax I can make cross-domain GET, POST, PUT, DELETE request to http://b.com but can not read the response from http://b.com
4) 来自 http://a.com using ajax I can make cross-domain GET, POST, PUT, DELETE request to http://b.com as well as read response from http://b.com
P.S。不期待任何关于 SOP 和 CORS 的讲座。请求简短而甜蜜的回答
唯一正确的答案是 1。仅仅因为 CORS preflight 请求 fails 在 3 和 4 上,所以实际请求甚至不会占用地点。