最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Direct download link for Google Drive files on android without opening google drive - Stack Overflow

programmeradmin5浏览0评论

On my webpage, I am downloading google drive files via the following approach:

;id=${fileId}

However, this only works on computers. On phones (such as an android), it opens up google drive instead of downloading the file.

On the other hand, if I paste the link on my phone's browser, it downloads as expected instead of opening google drive.

One solution that seems to work even on phones is by using google drive api:

;key=YOUR_API_KEY

However, the name of the downloaded file is set to the file ID instead of the file name.

I've seen an answer which says to use Content-Disposition headers to set the file name, however, I do not have any server-side support, and apparently I will need expressjs to set content headers (Please tell me if I'm wrong) . My webpage has to be client-side only.

So how do I obtain a google drive download link that:

  1. Works everywhere without opening google drive (iPhone/iPads are an exception as they don't allow downloads)
  2. Lets me keep or set the file name instead of setting the file id as the downloaded file name.
发布评论

评论列表(0)

  1. 暂无评论