admin管理员组文章数量:1353658
I read the document.
but I think I must have misunderstood it.
$http.defaults.headers.jsonp = { 'Accept' : 'application/json'};
$http.jsonp(url).success(function(data, status, headers, config) {
I also have tried
$httpProvider.defaults.headers.jsonp = { 'Accept' : 'application/json'};
$http.jsonp(url).success(function(data, status, headers, config) {
I wanted to change the Accept
to application/json
Neither work.
I read the document.
but I think I must have misunderstood it.
$http.defaults.headers.jsonp = { 'Accept' : 'application/json'};
$http.jsonp(url).success(function(data, status, headers, config) {
I also have tried
$httpProvider.defaults.headers.jsonp = { 'Accept' : 'application/json'};
$http.jsonp(url).success(function(data, status, headers, config) {
I wanted to change the Accept
to application/json
Neither work.
Share Improve this question asked Oct 26, 2013 at 6:38 Kim StacksKim Stacks 10.9k39 gold badges166 silver badges302 bronze badges1 Answer
Reset to default 7There is no way to control headers sent by a browser while using JSONP. JSONP is a smart trick (or a hack, depending on how you see it...) that consist of inserting a <script>
tag pointing to a server endpoint. Ultimately it is a browser who will decide which headers to sent while requesting scripts via <script>
tag and you can't influence it.
More info here: Modify HTTP Headers for a JSONP request
本文标签: javascripthow to change the headers for angularjs httpjsonpStack Overflow
版权声明:本文标题:javascript - how to change the headers for angularjs $http.jsonp - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743933944a2564348.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论