My Progressive Web App allows users to generate a PDF report by clicking on a link. However, when the file opens, there is only an OK button to close it. This issue occurs when the user adds the app to their home screen:
I tried using a simple <a href>
HTML tag, but even the OK button to close the file did not appear, forcing me to restart the app. When I used the JavaScript function window.open()
, I was able to include an "OK" option to close the file.
<img src="pdf.png" onclick='generatePDF(1045, 45)'>
function generatePDF(c, v){var window=window.open("generatePdf.php?c="+c+"&v="+v, "pdf", "location: 0;");}
I want to provide users with options to print, share, or save that PDF file locally. When the app is used in a Safari Tab, these options are available.
UPDATE 16/07/2019 It seems like Safari is finally addressing the bug related to the
<a href="" download="name">
tag, as mentioned here: iOS: Add support for the download attribute. Soon, the download tag will work properly again.