I have certain sites I have to print generated PDF documents. They are not just PDF links but buttons to generate the PDF with selected content. They used to open up in browser or preview but now Safari just starts a download and I don't need all of these files on my drive. Firefox gives me the option to preview or download on the same site.
2 Answers
IF the important part of the question is wondering how to ensure that clicking on a PDF opens the document automatically, consider checking the radio ("Open safe files after downloading) in Preferences / General (by pressing ⌘
+ ,
).
-
"I don't need all of these files on my drive" - well, this method still downloads the file.– Fuzzy76Apr 4 at 7:58
It is the web site that instructs the browser to download the PDF instead of viewing it:
Web sites usually controls this using the "Content-Disposition: attachment" header which is sent by the web server to the browser.
The web site probably changed from not sending this header to now sending the header, and so Safari will start a download instead of viewing the document.
In this case, I would suggest sending a feature request to the web site owner to let you have both a view and a download button for these PDFs.
Web sites also have the option of controlling this directly from HTML, although it is not as commonly used as the HTTP header. They do this by including am "download" attribute on the link itself (the "a" tag).
If that is the case, you could open the Developer Tools in Safari to manually edit the link and remove the download attribute before clicking. It is going to be quite tedious though.
-
Or, depending on how the PDF is generated (and if it is stored in the server for a certain time), it may be an
<a>
tag with thedownload
attribute set. Apr 13, 2020 at 9:31 -
1