4

We are creating a Word add-in where user can download documents. It worked perfectly fine, although in the console it gave a warning about downloading from an iFrame being deprecated.

After updating Chrome, I now get the following error when trying to download:

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.

When following the above link, it provides the following information:

Chrome is planning on removing this capability - i.e. Chrome is going to block all downloads initiated from or instantiated in a sandboxed iframe by default. The embedder may add "allow-downloads" to the sandbox attributes list to opt in. This allows content providers to restrict malicious or abusive downloads.

How can I add "allow-downloads" or "allow-downloads-without-user-activation" to the sandbox attributes in the Word add-in? Is there a workaround to enable downloading files?

Natalie Pakki
  • 79
  • 1
  • 3
  • Are you testing on Word on the web (formerly Word Online)? – Rick Kirkham May 26 '20 at 17:24
  • @RickKirkham, Yes, I'm testing on Word Online. – Natalie Pakki May 26 '20 at 18:20
  • I think the task pane in Word Online is an iframe. Does the add-in work if you use Edge or Firefox? – Rick Kirkham May 27 '20 at 16:56
  • Also, if you have a Mac, can you test on Safari? – Rick Kirkham May 27 '20 at 17:42
  • @RickKirkham, It works on Safari, Firefox, Edge. It doesn't work in EI and Chrome. – Natalie Pakki May 28 '20 at 07:41
  • 1
    I've discovered that there's a discussion internally in Microsoft about whether to add one or both of these attributes. No decision yet. In the meantime, a workaround that is used to download PDFs in Edge should work in this situation too: It is described at [Get errors trying to download PDF file](https://learn.microsoft.com/en-us/office/dev/add-ins/concepts/browsers-used-by-office-web-add-ins#get-errors-trying-to-download-a-pdf-file). – Rick Kirkham May 30 '20 at 04:09
  • I see that Microsoft team has added the attribute to iframe. Now it works in Chrome, but still doesn't work in IE. – Natalie Pakki Jun 30 '20 at 10:58
  • @RickKirkham I'm trying to use "Office.context.ui.openBrowserWindow(url)", but I don't see openBrowserWindow method in Office.context.ui. Only displayDialogAsync and taskPaneAction. – Natalie Pakki Jun 30 '20 at 13:50
  • For technical reasons, it is not documented yet and is not in Intellisense. But it is supported in Win32, Mac, iOS; but not Office on the web (aka Office Online). – Rick Kirkham Jun 30 '20 at 18:38
  • UPDATE: The attribute has been added. Please try again and see if it works now. – Rick Kirkham Jun 30 '20 at 18:49
  • It works in Chrome, but not in IE. – Natalie Pakki Jul 22 '20 at 08:34
  • But it's not related to this attribute in iframe. I've found the solution for IE which works for me. Thank you! – Natalie Pakki Jul 22 '20 at 09:24

0 Answers0