Having a very frustrating time getting Chrome and Firefox on iOS to download a file from my server using JS.
It works on Safari iOS and Android Chrome.
Tried using content-disposition headers and download attributes but no avail..
function downloadVideo(url){
new jsFileDownloader({
headers: [{
name: 'Content-Disposition',
value: 'attachment; filename="video.mp4"',
name: 'Content-Type',
value: 'video/mp4'
}],
url: '/download?url=' + url,
filename: 'file.mp4',
withCredentials: false,
forceDesktopMode: true,
contentType: 'video/mp4',
contentTypeDetermination: 'header'
}
)
data.map((link, index) =>{
links.innerHTML +=
`
<button onclick=downloadVideo("${link}") target="_blank" href="${link}"download=${index+1}.mp4>Download #${index+1}</button>
`
})