大佬教程收集整理的这篇文章主要介绍了带有域字段的CORS cookie仅在使用jQuery AJAX的Firefox中设置,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
是否有可能让它在除firefox以外的其他浏览器中运行?
一些请求标题:
Accept:application/json,text/javascript,*/*; q=0.01 Content-Length:55 Content-Type:application/x-www-form-urlencoded; charset=UTF-8 Host:localhost:53862 Origin:http://localhost:54265 Referer:http://localhost:54265/
响应标题:
Access-Control-Allow-Credentials:true Access-Control-Allow-Headers:x-requested-with,origin,content-type,accept,Proxy-Connection Access-Control-Allow-Methods:GET,POST,PUT,OPTIONS,deletE Access-Control-Allow-Origin:http://localhost:54265 Set-Cookie:Auth=l_hash=123456&user=xyzl&remember_me=false; expires=Fri,18 Jan 2013 13:42:10 GMT; domain=localhost; path=/
码:
$.ajax({ type: "PUT",url: apiHost + "api/account/login/",data: $("#loginBarForm").serialize(),dataType: "json",contentType: "application/x-www-form-urlencoded; charset=UTF-8",crossDomain: true,xhrFields: { withCredentials: true },});
在Firefox中一切都很好. Chrome未设置Cookie.仅当域字段被删除时,所有浏览器都在运行.我可以在下一个请求(设置cookie后)中看到cookie出现在标题中.响应设置cookie后的firefox请求示例(当响应有域字段时):
Cookie: Auth=l_hash=123456&user=xyz&remember_me=false
以上是大佬教程为你收集整理的带有域字段的CORS cookie仅在使用jQuery AJAX的Firefox中设置全部内容,希望文章能够帮你解决带有域字段的CORS cookie仅在使用jQuery AJAX的Firefox中设置所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。