After Chrome version 83 release, file download in modal dialog doesn't work

前端 未结 1 1937
情深已故
情深已故 2020-12-04 03:28

I use Google Apps Script to make download Spreadsheet data quickly.

Since several days before, download function doesn\'t work suddenly. Some of my coworkers who can

相关标签:
1条回答
  • 2020-12-04 04:15

    Problem

    Cannot download a file via link in modal dialog

    Reason

    The ability to do so is deprecated since Chrome 83 (hence the issue). Modal dialogs are sandbox environments, therefore your script stopped working. If you open the developer tools (press f12), you will see a warning:

    Download is disallowed. The frame initiating or instantiating the download is sandboxed, but the flag ‘allow-downloads’ is not set. See https://www.chromestatus.com/feature/5706745674465280 for more details.

    Adding a download attribute to the link mitigates that part, but you will encounter the second warning:

    Resource interpreted as Document but transferred with MIME type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

    What to do

    As of now, there is an open issue regarding the matter, and it is promised that the allow-downloads flag will be added to HtmlService.XFrameOptionsMode.ALLOWALL - you can add the option to modal dialog via setXFrameOptionsMode and look for the updates.

    0 讨论(0)
提交回复
热议问题