S
S
sondor2017-12-08 17:35:09
PHP
sondor, 2017-12-08 17:35:09

How to make firefox correctly set the filename to .pdf by default if the url has a .html extension?

I generate a pdf file in the headers I pass header('Content-type: application/pdf');
The link to the script has the following form: root/gen_pdf/name_file.hml?get_params
The document must be previewed with the possibility of further saving.
Chrome and Opera in the prev menu Viewers offer to save the file as name_file.pdf , Firefox in the preview menu sets the file name as document.pdf.
If browsers are set to automatically download pdf: Chrome/Opera download the name_file.pdf file; Firefox file name_file.html.
What are the solutions to firefox by default set the file name name_file.pdf

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Skibin, 2017-12-08
@megafax

Try adding a header to your response

Content-Disposition: attachment; filename="filename.pdf"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question