The saveAs option in chrome.downloads.download is not working as expected, as it always opens the

I am currently working on an extension that will allow users to download multiple files simultaneously. Using the Chrome downloads API along with AngularJS, here is the code snippet:


var fileDownloadProperties = function(raw) {
    return {
        url: "https:" + raw.url,
        filename: sharedDir + "/" + raw.name + "pdf",
        saveAs: false
    }
};
$scope.status = "";
filesToDownload.forEach(function(raw) {
    chrome.downloads.download(fileDownloadProperties(raw));
});

The issue I am facing is that the saveAs option is being ignored when the script runs, prompting the save as dialog to appear. This becomes cumbersome when downloading many files as each save dialog only opens after the previous file has finished downloading.

I have attempted to find a solution by using different methods, such as the code snippet below, but none have successfully prevented the save dialog from opening:


var a = document.createElement("a");
a.href = files[0];
a.download = files[0];
a.click();

If anyone has any suggestions on how to force Chrome to download files silently and simultaneously, I would greatly appreciate the help. Thank you.

Answer №1

If you want to guide your user on configuring Chrome settings, you can suggest the following:

Enable the option to prompt for the download location for each file

Toggle the "Save As" functionality on or off based on preference.

Answer №2

While Jenna's workaround is acceptable, I am not inclined to label it as the "Accepted solution" since it involves forcing users to change their preferences. An issue has been raised regarding this bug in this thread.

The best course of action would be for the chrome team to take charge and address this problem for us developers. I suggest adding pressure to the thread by leaving a comment outlining the importance and urgency of fixing this issue. Additionally, don't forget to click the star to emphasize the significance of the problem.

https://i.sstatic.net/Bm7uH.png

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for displaying an element from an ng-repeat with ng-click action outside of the loop

Looking for help with working on a simple array of objects containing {name,age}? Check out my jsfiddle. I'm currently using ng-repeat to display all the names and am trying to figure out how to display the age of the name when clicked outside of the ...

Unable to Retrieve Modified Content with $().text();

In the process of developing an app, I am encountering a challenge where I need to transfer user input to another element after processing it. However, I am facing an issue with accessing the updated value of the <textarea> using .text(), as it only ...

Is there a way to retrieve the filename of a file uploaded using a shiny fileInput function?

This shiny app has a feature where users land on the 'Upload data' panel upon launching. To restrict access to the other two 'tabpanels', users must first upload both necessary files in the 'Upload data' tab. The condition for ...

Authorization error: The specified URL is not permitted by the application settings for Facebook login using the Javascript SDK

Encountered an error while trying to implement Facebook login using Javascript SDK in Chrome console: The given URL is not permitted by the application configuration: One or more of the URLs provided are not allowed by the app's settings. It must ...

Error: The identifier has already been declared and cannot be re-declared

I am attempting to create a modal-cookie feature that will display a modal on page load if a cookie named "name" does not exist. However, I encountered an error: Uncaught SyntaxError: Identifier 'addCookie' has already been declared. This erro ...

Dropdown list remains open despite a selection being made

My problem arises when I attempt to select an item from the list, as the dropdown menu does not populate automatically and the list remains open. Here is the HTML code for the dropdown list: <label id='choose' for='options'>Sele ...

Updating checkboxes in Vue.js

I'm struggling a bit with VueJS states. Here is the setup for my simple app: new Vue({ el: '#media-app', data: { activeTypes: [], activeCategories: [], medias: [] }, methods: { getFilteredDat ...

Retrieve text from a dropdown menu while excluding any numerical values with the help of jQuery

I am currently implementing a Bootstrap dropdown menu along with jQuery to update the default <span class="selected">All</span> with the text of the selected item by the user. However, my objective is to display only the text of the selected it ...

What is the best way to eliminate specific duplicate characters from a string using JavaScript?

I have a project involving managing email responses, where the reply function includes pre-written content like Re: ${Subject of the email} The issue I'm facing is that after the 2nd reply, there is a repeated Re: , so I created a function to remove ...

Can a form be submitted using an Ajax request triggered by a div element instead of an input type submit?

I used to submit the form by triggering $(".btn-update.").click() before, but now that I'm using $(".btn-update").ajaxForm(), the form is not getting submitted. Here is the HTML code: <form id="company-profile-edit-form" name="company-profile-edi ...

Having trouble getting the .toggle() function with classList to work on one element, despite working fine on others

I've been struggling to apply a class to an HTML element when I click on another element of the page. Despite numerous attempts, it just doesn't seem to work for me. Let's take a look at my code: HTML Code: <div class="container&qu ...

Tips for binding data to an MVC partial view with AngularJS directives

I am working with an AngularJS directive that requests a partial view from an MVC controller: app.directive("partnersInfoView", function ($http) { return { restrict: 'A', link: function ($scope, element) { $http.g ...

How to style TextInput to display dollar amounts when using onChangeText and Redux in React Native

Struggling to format number input in a TextInput using the onChangeText function in React Native with Redux. Tried using .toFixed(2) function, but encountering an issue where it interprets the next digit as the first decimal and rounds back to 0 due to Re ...

Tips for positioning input fields and labels in both horizontal and vertical alignment

Below is the HTML code, and I want the tags to look like this: label1: input1 label2: input2 label3: input3 Instead, it currently looks like this: label1: input1 How can I modify the HTML to achieve the desired format? HTML: <div class=" ...

Using the `setTimeout` function to swap components

As I work on implementing a setTimeout method, the goal is to trigger an event after a .5 second delay when one of the three buttons (drip, french press, Aeropress) is pressed. This event will replace {{ShowText}} with {{ShowText2}}, which will display &ap ...

Switch Selector for React Native

Although it may seem simple, I'm having trouble getting a function to automatically switch between the "user" and "business" options on the switch selector without requiring manual input from the user. I attempted to use: const switchRef = useRef(nu ...

What is the best way to ensure that all website users receive the same update at the same time using AngularJS and Firebase?

Imagine a scenario where I and my 3 friends are accessing the same website from different computers simultaneously. Each of us has a profile stored in an array like this: $scope.profilesRanking = [ {name:"Bob", score: 3000}, {name:"John", score: 2 ...

What is preventing me from installing socket.io?

I keep seeing an error in the console, what could be causing this? npm ERR! code 1 npm ERR! path E:\full-stack\proshop-2\socket\node_modules\utf-8-validate npm ERR! command failed npm ERR! command C:\WINDOWS\system32&bso ...

What is the best way to manage the maximum number of concurrent AJAX requests?

I am currently working on an autocomplete search bar feature. <input type="text" class="form-control" id="text" > <script> $("input").keyup(function(){ let key = $("input").val(); ...

What is the code to convert data to base64 in Javascript when it is not a string?

I am in the process of transferring functionality from an Objective-C iPhone application to a JavaScript iPhone application (using Appcelerator Titanium). In my Objective-C code, I have an NSData object that represents a specific token: //NSData object sh ...