似乎我们不能再programmatically download content通过浏览器中的JavaScript共享链接。方法有变化吗?
当我尝试以下链接时,他们不再返回Access-Control-Allow-Origin: *
标题:
他们曾经拥有正确的CORS标头。我们现在应该如何通过JavaScript下载公共内容?
答案 0 :(得分:2)
对我来说似乎工作正常。也许您可以分享您正在使用的代码以及您所看到的具体问题:
$ curl -i https://dl.dropboxusercontent.com/s/mrt5fei8gsndfqb/test.json -H Origin:www.example.com
HTTP/1.1 200 OK
accept-ranges: bytes
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Accept-Ranges, Content-Range, X-Dropbox-Metadata, X-Dropbox-Request-Id, X-JSON, X-Server-Response-Time
Access-Control-Max-Age: 600
cache-control: max-age=0
content-disposition: inline; filename="test.json"; filename*=UTF-8''test.json
Content-Type: text/plain; charset=utf-8
Date: Sat, 07 Mar 2015 20:43:09 GMT
etag: 384005n
pragma: public
Server: nginx
set-cookie: uc_session=7OdIkBHxIyByXccQK7zTrCJxlvuEZEThdbehLwKo2eaQTiaxETBhvI0yS8wrNt3H; Domain=dropboxusercontent.com; Path=/; secure; httponly
x-dropbox-request-id: 7bf5833588818b70adca21e463ce77d9
X-Robots-Tag: noindex, nofollow, noimageindex
x-server-response-time: 170
Content-Length: 18
Connection: keep-alive
{"success": true}