Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
How to fix downloads with `chrome.downloads` extensions' API getting automatically interrupted if download confirmation setting is ON?

Description

I am developing a small Chrome extension and needed to download a file off web. Here's how the script behaves:

  1. I initiate the download in my service_worker JS file (either on a command event or with no conditionals at all)
  2. The download starts
  3. The callback runs and receives an ID (which means download starts successfully)
  4. The download never completes (saveAs dialog never opens even if set to true)
  5. Upon analyzing the DownloadItem object for the returned ID, its status is found to be interrupted and its reason to be USER_CANCELED
  6. No errors are reported in either of the consoles -- the page's or the service_worker's -- or the extensions page
  7. chrome.runtime.lastError is undefined as well.

Current Config

  • downloads in the permissions
  • <all_urls> in host permissions (for debugging)

Observation

  • The download succeeds if:
    • Ask where to save each file before downloading setting is turned off and...
    • filename/saveAs isn't set in passed DownloadOptions

But shouldn't the download work nonetheless?

Background.js

chrome.commands.onCommand.addListener((command) => {
  const url = "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"; //random image
  chrome.downloads.download({url, saveAs: true}, (id) => {
    console.log(chrome.downloads.search({id}, (result) => {
      console.log(result)
      console.log(chrome.runtime.lastError)
    }))
  })
})

Any idea what's going on? Any help would be highly appreciated!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda