Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to donwload/save video in Chrome on iOS?

I have a React app with a video player on a page. The player is made with a <video> html tag. There’s a Donwload video button under the player and onClick handler on it. On click this function fires:

const downloadFile = (url: string) => {
  const a = document.createElement('a');
  a.href = url;
  a.click();
};

It works nice on PC, the file downloads without any problems. But when I try to download a file from iPhone then a video opens in fullscreen without ability to download/save it to iPhone. How to fix this?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Hey could you please try this if this helps…

const downloadFile = (url: string, filename: string) => {
  const a = document.createElement('a');
  a.href = url;
  a.setAttribute('download', filename);
  a.click();
};

Please let me know if this works..!

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading