Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!