如何设置“Access-Control-Allow-Origin:*” jquery中的标题 [英] How to set "Access-Control-Allow-Origin: *" header in jquery

查看:99
本文介绍了如何设置“Access-Control-Allow-Origin:*” jquery中的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在jquery中设置Access-Control-Allow-Origin:*标题

How to set "Access-Control-Allow-Origin: *" header in jquery

推荐答案

这不是关于'你如何'做某事,而是'为什么'你做的很重要。



Access-Control-Allow-Origin 标题被服务器用来告诉浏览器 CORS [ ^ ](跨源资源共享)是否允许。



因此,你不要设置它客户端,但您的Web服务器需要将其添加到响应中。



顺便说一句,这里有关于CORS的好文章。



http://www.html5rocks.com/en/tutorials/cors/ [ ^ ]
It's not about 'How' you do something but 'Why' you do is important.

Access-Control-Allow-Origin header is used by the server to tell the browser if the CORS [^](Cross-Origin Resource Sharing) is allowed or not.

Thus, you don't set it from the client but your web server needs to add it in the response.

By the way, here is nice article on CORS.

http://www.html5rocks.com/en/tutorials/cors/[^]


这篇关于如何设置“Access-Control-Allow-Origin:*” jquery中的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆