有点API支持CORS吗?

时间:2014-10-01 12:38:54

标签: javascript cors url-shortener

我在他们的文档中看到CORS受支持。但我尝试从JavaScript发出请求并没有成功。

请求此网址:

https://api-ssl.bitly.com/v3/shorten?longUrl=https://google.com/&access_token=token&domain=bit.ly&format=json&languageCode=en-US

我收到标准错误:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://google.com' is therefore not allowed access.

UPD:有点文档 - http://dev.bitly.com/cors.html

1 个答案:

答案 0 :(得分:0)

如果有人还有这个问题。发生这种情况的原因是因为来自bitly的选项(预检)响应不包括'Access-Control-Allow-Origin'标题。

为了解决这个问题,我使用了不发送预检的XMLHttpRequest。

RecyclerView.Recycler

实际上是在bitlly的RecyclerView

中提到的
相关问题