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 download DataURL as png on mobile using Javascript?

To preface, I am using mapbox to create a map then I use the getCanvas and toDataURL methods to get the image data.

Here is my code to download an image. So far, I am able to download the image properly on my desktop, but on mobile I download the image as file with no extension. I have to manually change the file to a .png then it works.

Is it possible at all to make sure that on mobile the file downloaded is a png?

I have tried using the Image class previously to no avail.

        let dataURL = props.map.getCanvas().toDataURL();
        var download = document.createElement('a')
        download.download = 'map.png'
        download.href = dataURL
        download.target = '_blank'
        download.click();
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