我正在尝试通过ajax POST在IE11上使用Bitly V4 URL Shorten API,但是在预检(OPTIONS)调用后收到安全错误。我的实现和遇到的错误如下:
$.ajax({
type: 'POST',
url: 'https://api-ssl.bitly.com/v4/shorten',
data: JSON.stringify({group_guid: '<Bitly_group_guid>', long_url: 'https://www.google.com'}),
dataType: 'json',
contentType: 'application/json',
headers: {
'Authorization': 'Bearer <Bitly_generic_access_token>',
},
}).done(function (resp) {
console.log('OK');
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log('NOT OK');
});
SEC7123:在Access-Control-Allow-Headers列表中不存在请求标头内容类型。
SCRIPT7002:XMLHttpRequest:网络错误0x80070005,访问被拒绝。
access-control-allow-headers:*
access-control-allow-methods:HEAD,GET,POST,PUT,PATCH,DELETE
access-control-allow-origin:*
允许:POST,选项
alt-svc:清除
内容长度:0
content-security-policy:default-src'none
日期:2019年11月28日星期四03:13:04 GMT
服务器:nginx
strict-transport-security:max-age = 31536000; includeSubDomains
via:1.1 google
x-content-type-options:nosniff
x-frame-options:DENY
x-xss-protection:1; mode = blockFilter
最后,POST方法根本不执行,但是在Chrome和Mozilla上使用相同的代码,但是POST方法已执行并设法缩短了URL。
感谢任何人都可以分享见解来克服这一问题。
我正在尝试通过ajax POST在IE11上使用Bitly V4 URL Shorten API,但是在预检(OPTIONS)调用后收到安全错误。我的实现和遇到的错误如下:我的代码:$ ....
查看文档后,我发现有关浏览器对Bitly api支持的信息。