-2

I've worked on my website for month, and after a while I've restarted. And I have a page where I can upload file and open them in a viewer. With Chrome I don't have any problem, everything works just fine! But when I try it on Firefox, it just downloaded.

Is there a way to open PDF on mozilla instead on downloading?

Thanks for anyone who can clarify this for me!

Natao
  • 1
  • 2

1 Answers1

0

HTTP Headers to force browsers to open a file instead of downloading it:

How do I force files to open in the browser instead of downloading (PDF)?

If you want to set your own Firefox to open PDFs:

By default, Firefox should display PDFs inline unless your website has explicitly told it to download the file rather than open it.

If you go to the Firefox URL bar and type in about:config and press enter, then once you pass the warning notice at the top you will need to type in browser.download.open_pdf_attachments_inline and change this setting from default false to true.

You should also confirm that browser.shell.setDefaultPDFHandler.onlyReplaceBrowsers setting is also set to true.

Exit and then retry. PDFs should now open inside the browser itself rather than any 3rd party reader.

Read more here from Mozilla.

If you want to set so any browser that visits your website views PDF inline:

Recommended way to embed PDF in HTML?

Martin
  • 22,212
  • 11
  • 70
  • 132
  • I would bet he's wanting to do this from the server side, not configuring his browser. The info is available all over the internet, too. – Rob Sep 06 '22 at 08:55
  • @Rob yes the thought had occurred to me. I'm actually likely to delete this as I found on my own Firefox that it opens PDFs by default so maybe OPs has been changed – Martin Sep 06 '22 at 08:59
  • 1
    And if his question is about how to configure Firefox, that makes it off topic here, too, as it's not a programming quesiton. – Rob Sep 06 '22 at 09:01
  • @Rob I think I've covered all the bases in my answer there – Martin Sep 06 '22 at 09:07
  • I'm using a computer at my workplace so i dont know if some settings were touched; but anyway I dont need it just for my PC but also for anyone who visit my site. I tried looking online but just found ways locally. I'm gonna look through the last link to told me. Thanks @Martin – Natao Sep 06 '22 at 12:25