Hello to all! there is a link, I get it from youtube, to download a video (asp.net mvc application) to the tag I sign the download attribute - and after the click, the video starts downloading in all browsers, except for firefox.

Download video

Can you please tell me how to make a video download in firefox too?

  • Can html-code just in case? - andreymal

1 answer 1

your domain1.com site, and download from domain2.com? (in this case, YouTube?)

<a href="http://domain.com/file.txt" download>click</a> 

Alas, a relative resource address is required for ff, or see CORS Headers FF

As an option - to make a separate controller method, make the link relative, but in the Beck, the request goes to the address you need, for example:

 <a href="download?somefilename=file.txt" download>click</a> public FileResult Download(string fileName) { byte[] fileBytes = System.IO.File.ReadAllBytes(@"http://domain.com/file.txt"); return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName); } 
  • And how can I immediately make a relative reference? and can it somehow get around javascript? - Dmitriy
  • @Dmitriy, yes, if a third-party site gives the file just for downloading, then you can dynamically create an iframe with the specified URL - download will be done with saving - SanŚ́́́́́́́́́́́́
  • And if the site does not give to download?)) Well, as in my case? - Dmitriy
  • Then it is better only as I described above. - SanŚ́́́́́́́́́́́́-