Reputation: 779
File download feature is not working for my MVC-Bootstrap web application that uses an iframe in Iphones/Ipads ( for both Safari and Chrome). Everything works well in desktops,laptops and in Android devices ( for all browsers).
In a button click, I use the below Jquery code to invoke an iframe to download a PDF
$("#iframedownload").attr("src", downloadURL);
downloadURL points to the page that has the code to download the file.
Code to download file
return File(filebyteArray, "application/pdf", string.Format("Myfile.pdf",
DateTime.Now.Ticks.ToString()));
Iframe
<iframe id="iframedownload" style="display: none"></iframe>
Any thoughts on this ?
Upvotes: 2
Views: 2374
Reputation: 779
Looks like iframe download approach is not supported in Iphone/Ipad
Use window.location instead
window.location = "@Url.Action(Action, Controller)";
Upvotes: 1