I'm currently utilizing file-saver within my Angular application to retrieve a PDF generated from the backend. The library functions smoothly on desktop and Android devices, but I'm encountering issues with downloading files on iOS. Contrary to what is mentioned on the GitHub page, file-saver does not open the blob in a new window; instead, it opens on the same page (which is undesired). Interestingly, it works seamlessly on Safari by prompting a download dialog without opening the file, but fails on other browsers like Opera, Firefox, and Chrome.
I've experimented with various alternatives such as file-saver, downloadJ, creating an anchor tag with the download attribute, utilizing the application/octet-stream mime-type, and exploring different solutions found online. Unfortunately, most of these methods either do nothing or result in the PDF displaying on the same page rather than initiating a download or opening in a new tab (as specified by file-saver for iOS).
As the PDF is being generated in a Google Cloud Function, I am wondering if there might be a way to bypass the client-side processes and have the browser directly download the file from there.
Is there any alternate approach to downloading PDFs on mobile iOS devices (such as implementing a service worker)?
Appreciate any input or suggestions in advance.