Tampermonkey / tampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.28k stars 424 forks source link

GM_Download saveAs:false doesn't work on Chrome #1063

Open hjyssg opened 4 years ago

hjyssg commented 4 years ago

Expected Behavior

GM_Download saveAs: false will prevent dialog from popping up

Actual Behavior

Dialog pop up

Specifications

Script

https://greasyfork.org/en/scripts/415407-twitter-download-all-images

function GM_downloadPromise(_link, fn){
  return new Promise((resolve, reject) => {
    GM_download({
            url: _link, 
            name: fn,
            saveAs: false,  // this do not work for Chrome
            onerror: err => {
                console.error("error", _link);
                reject(err);
            },
            ontimeout: ()=>{
                console.error("timeout", _link);
                reject("timeout");
            },
            onload: ()=>{
               resolve();
            }
    });
  })
}
hjyssg commented 4 years ago

image

I found that Chrome has setting to turn the dialog off. But it seems work for all kinds of download.

derjanb commented 4 years ago

Have you tried changing the Dowload mode to Browser API? (You have to set Config Mode to Advanced first.)

image

Owyn commented 3 years ago

I tried browser APi in chrome 87 and it just doesn't do anything, also no error, but native API works, well downloading works, but saveAs just does nothing - there is no pop up, it just starts downloading right away

 console.warn("GM_download " + i.src);
                var details = { url: i.src,
                                name: "test.jpg",
                                saveAs: true
                              };
                details.onerror = function(e) {
  console.error("Error GM_DL: ", e );
};
                GM_download(details);
Starrah commented 3 years ago

Have you tried changing the Dowload mode to Browser API? (You have to set Config Mode to Advanced first.)

image

I have met the exactly same problem as the issue's author, i.e. saveAs: false doesn't prevent the dialog from poping up. I'm sure that I've already changed the Dowload mode to Browser API and given the required permission. 微信截图_20210122170335 My environment is:

Thank you!

manageryzy commented 3 years ago

My environment is:

same issue

disco0 commented 3 years ago

Having same issue with latest Chrome Canary build (with Browser API download mode):

95.0.4634.3 (Official Build) canary (x86_64)

However same userscript is working fine with latest Chrome base (with same settings/Chrome flags/downloads folder):

93.0.4577.63 (Official Build) (x86_64)

Tampermonkey Version: 4.14.6143 OS: macOS Version 10.14.6

Luoxcat commented 2 years ago

Same Problem

` const getBulkURL = async (dateRange) => {

let startDate = dateRange[0]
let endDate = dateRange[1]

for (let date = startDate; date <= endDate; date = startDate.add(1, 'days')) {

  let f_date = date.format(dateFormat)
  let reportURL = awaitApi.queryReportDownloadURL(f_date, f_date)

  let filename = f_date + '.csv'

  GM_download({url:reportURL, name:filename, saveAs:false})

  await sleep(1000)
}

}`

fritz-net commented 2 years ago

Same issue

tampermonkey v4.16.1 chrome Version 103.0.5060.134 (Official Build) (64-bit) win10

saveAs:false is set. With 'browser api' it is opening a windows with 'nativ' its not doing anything

derjanb commented 1 year ago

Please try https://github.com/Tampermonkey/tampermonkey/issues/1568#issuecomment-1250655586