How do I use exportlinks from javascript to downlo

2019-04-09 20:50发布

I'm trying to download content from a Google docs file using Javascript using the Drive SDK.

I retrieve the metadata, and parse the exportLinks to get a URL https://docs.google.com/feeds/download/documents/export/Export?id=xxx&exportFormat=html

My code is similar to Google Drive using JavaScript: Handling file content except I'm using exportLinks:text/html instead of downloadUrl.

If I try to retrieve that URL, I get "405 OPTIONS method not allowed".

(as an aside, if I download a non-docs file using the downloadUrl, all is OK).

So I'm guessing that either:- a) I shouldn't be using Drive to retrieve Docs files b) I should be using the exportLinks is some other fashion, or c) I need to implement the same iframe workaround that is used for upload here Does https://www.googleapis.com/upload/drive/v2/files really support CORS?

1条回答
戒情不戒烟
2楼-- · 2019-04-09 21:00

Export links do not currently support CORS. It is something we are working on, so sorry about that.

If you can use the iframe hack for now, until we get it working, then please do.

查看更多
登录 后发表回答