看来我们不能再以编程方式下载内容 https://blogs.dropbox.com/developers/2013/08/programmatically-download-content-from-share-links/通过浏览器中的 JavaScript 共享链接。方法有改变吗?
当我尝试以下链接时,它们不再返回Access-Control-Allow-Origin: *
header:
- https://www.dropbox.com/s/mrt5fei8gsndfqb/test.json?raw=1 https://www.dropbox.com/s/mrt5fei8gsndfqb/test.json?raw=1
- https://dl.dropboxusercontent.com/s/mrt5fei8gsndfqb/test.json https://dl.dropboxusercontent.com/s/mrt5fei8gsndfqb/test.json
他们曾经拥有正确的 CORS 标头。现在我们应该如何通过 JavaScript 下载公共内容?
它似乎对我来说工作得很好。也许您可以分享您正在使用的代码以及您遇到的具体问题:
$ 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}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)