Trouble downloading files in Google Apps Script web app after Chrome update - google-chrome

I've had a Google Apps Script web app running for a bit over a year which gave users an option to download a csv file. 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" to the sandbox attributes in the Google Apps Script environment? Alternatively, is there a workaround to enable downloading files?

It is discussed here https://issuetracker.google.com/issues/157368720 that HtmlService.XFrameOptionsMode.ALLOWALL should set allow-downloads on GAS web app sandbox. We should watch this issue for changes.

Include sandbox="allow-downloads" in your iframe tag, which contains the code that is used for downloading the CSV file.

Update as of 07/29/2020:
The attribute "allow-downloads" has now been added to the sandbox attributes and there is no longer any issue downloading files.

There is one work around that I found if you have a download button, you can right click and open in a new tab. You have to rename the file but at least you can get it, until there is a fix.

Related

What is the internal file format of a .glink file?

I would like to add URL links into a web-based Google Drive folder. Searching online, it appears that this was once possible with files that ended in a .glink extension. I'm looking for documentation on the file format so that I can create them programmatically.
[EDIT] Why do I want to create .glink files? Because I want links (bookmarks, URLs) to be able to appear in my Google Drive web page and to be able to click on them an go to the page. Microsoft OneDrive supports this functionality.
GLINKS Files
The URL link file feature was available due to a workaround with Back Up and Sync before being deprecated with Drive for Desktop. The .glink seems to be patched and no longer available as it was also part of a third party tool no longer available. It seems it now only saves them as .URL and automatically gives it the icon for Google Docs, as it would take it as a simple file with text.
Checking the .url type file of Windows, when uploading to Drive it does not update as it should, even utilizing Drive for Desktop (as an alternative to sync data like back up and sync) the outcome is the one suggested above.
This is the main reason why there is no longer any documentation about the matter, due to this one not being an official feature and being also fully deleted, it can be confirm by the file type available when creating files with the Drive API:
https://developers.google.com/drive/api/guides/ref-export-formats
I would suggest to request a feature to allow this or to provide a new way to store URL links as before or report it to review if possible any references on how it used to work by submitting a feature request or checking the issue tracker about the matter:
https://issuetracker.google.com/issues/new?component=191650&template=824106
You can also add the details of the previous threads or discussions about the GLINKS.

How to enable "allow-downloads-without-user-activation" from sandbox attribute in Word add-in

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?

Google Colaboratory and Google Drive integration fails

I am not able to save a new notebook in my Google Drive environment.
Google Colaboratory works with predefined notebooks such as Hello, Colaboratory, but I am not able to save any into my Drive folder.
I have the Colaboratory app allowed in the Google Drive settings and really dont know how to solve it. Colaboratory communicates with Drive - it even creates the notebook files in the Google Drives folder, but when loading any notebook file it always report following Notebook loading error
There was an error loading this notebook. Ensure that the file is accessible and try again.
Neither the details of the error help much:
Failed to fetch TypeError: Failed to fetch
I was playing with the access rights of both the file and the folder and could not find any solution.
Update: Chrome 64.0.3282.167 (64 bit); Windows 10 1709. I use two users on the Chrome. Creating Notebooks works normally on different computers with my username.
This is the output from console:
Chrome Console Output
On Google Chrome, I was seeing this issue randomly and it mentioned not being able to load the file /some/google/path/thats/gone/because/this/fixed/it/client.js. I tried clearing my cache and hard reloading, and sure enough, Colab starting working again.
As with standard cookies, third-party cookies are placed so that a site can remember something about you at a later time. Both are typically used to store surfing and personalization preferences and tracking information.
Google's colaboratory uses third party cookies and your browser most likely has them disabled.
Navigate to your browser settings, search for cookies and enable third party cookies. This should hopefully fix your problem.
I had the same problem, and I just disabled AdBlock on google Colab in everything works perfectly.
try to close/pause AdBlock and reload the page, it works for me.

how to run batch file in chrome

I tried using very simple HTML to create several links to several batch files on my server that are intended to run when users click on the links. Using Chrome, every time I click on one of those files my browser displays the script itself (even though its a .bat) and doesn't actually run the script. Internet Explorer runs it every time, however all the users on the network use Chrome for web browsing.
Is there any way to force Chrome (preferably through HTML or VB or some other scripting on the page itself rather than change all of the users' browser settings) to run these batch files when the user clicks on the link?
The answers given so far - that it's "not possible" - are incorrect or outdated. Using Chrome Apps you can call executables (called "hosts") if they are registered with Chrome. Of course a Chrome App is a client application so you need to distribute it.
See https://developer.chrome.com/extensions/nativeMessaging#examples
HTML, JS on browser cannot run shell command, command line. You have to implement server script to execute your bat file then call it from HTML, JS via Ajax or direct link.

right-click-then-open-with works but simple left-click does not

At some point in the last couple of days a bug seems to have materialised in my app's Google Drive integration, despite me not having changed anything, and usage remaining fairly constant.
When you left click one of the app's documents in Drive a new about:blank tab opens showing the app's icon and the text "Sorry, an error occurred while opening this file. Please try again. [XXXXX]" where [XXXXX] is a short string that seems to be different every time. The create new works fine, and if you use the right-click menu and open with it also works fine.
All of this makes me think that there is a bug in the latest javascript update to Google Drive's main interface.
In terms of debugging, in the apiconsole the app has...
The initiate oauth2 option unchecked
The allow multiple files option unchecked
Mobile browser support checked
24 mime-types, 61 primary extensions, and 1 secondary extension registered
If it is a bug as Claudio has mentioned, I believe Google Drive SDK documentation needs to be updated too, since 'open' action is described only for "Open With" option:
https://developers.google.com/drive/integrate-open
I'm wondering how to trigger the proper action when registred mime-type can be managed by more than one installed application? Is there a way to set the default open action - or the application which created it will be used as the default? What's happen if you reach the application web by typing the url (not from UI Drive UI create action) and save the content on Drive, since you may be already authorized to do it?