搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

view pdf files (file protocol) in firefox

  • 23 回覆
  • 6 有這個問題
  • 6032 次檢視
  • 最近回覆由 Mr_and_Mrs_D

more options

been struggling some time : I want to open a pdf file from *my computer* in firefox : drag and drop produces an address like "file:///C:/path/to/file.pdf" but for clicking enter just pops up the Save dialog and choosing open with firefox just pops the same dialog over and over again

Windows 7 x64, latest FF

被選擇的解決方法

Reported it here : https://bugzilla.mozilla.org/show_bug.cgi?id=930763

closing this - post your questions/findings in the bug report

從原來的回覆中察看解決方案 👍 0

所有回覆 (20)

more options

Firefox Menu > Tools > Options > Applications

  • Search for PDF and change the Action to Preview in Firefox
more options
more options

It is already so - have you tried it ?

more options

did you read the question ? I want to drag and drop or hit Ctrl+O and open a pdf not preview online pdfs - this works. I mentioned the file protocol

more options

Dragging a PDF file in a Firefox tab works for me on Linux with the built-in PDF Viewer.

What is your setting for handling PDF files?

Are you using the built-in PDF Viewer or the Adobe Reader or or another external program?

If you have disabled the built-in PDF Viewer then you may need to check the value of the plugin.disable_full_page_plugin_for_types pref on the about:config page and remove the application/pdf part if present or reset the pref to the default via the right-click context menu.

more options

Thanks

Nope I have not disabled the built in viewer and it works great for online docs (I did say this)

Tools > Options > Applications

Portable Document Format (PDF) ---> preview in browser PDF document ---> always ask (NO OPTION preview in browser, other option is Other... which opens a list of apps)

plugin.disable_full_page_plugin_for_types --> user set > string > application/pdf

I swear I have not set this - was using Sumatra pdf plugin (no adobe)

Reset to default (empty) still DnD pops the save dialog

more options

So the pdfjs.disabled pref is set to false to enable the built-in PDF Viewer?

Otherwise Firefox will not use the built-in PDF Viewer and if there isn't a plugin to handle PDF as well then you get the dialog to save the file or open in another application. Current Firefox versions have enabled a built-in PDF Viewer that doesn't have all features that other PDF readers like the Adobe Reader have or may not function properly otherwise.

You can change the action for Portable Document Format (PDF) from Preview in Firefox to use another application like the Adobe Reader or set to Always Ask in "Firefox > Options/Preferences > Applications".

You can set the pdfjs.disabled pref to true on the about:config page to disable the build-in PDF viewer.

You can check the value of the plugin.disable_full_page_plugin_for_types pref on the about:config page and remove the application/pdf part if present or reset the pref to the default via the right-click context menu.

See also:

more options

I am using the pdf viewer to view pdfs online. I can't use it for viewing **offline pdfs**. plugin.disable_full_page_plugin_for_types is now reset --- DnD still doesn't work and now in the Save > Open with it does not offer to open it with FF - so it made things worse

more options
more options

On Windows 7, I get a similar result:

  • Drag and drop onto a blank tab from a local folder: Open/Save/Cancel dialog
  • File menu > Open > same file: Open/Save/Cancel dialog

Maybe this is a limitation of the PDF viewer, that it can't view local files due to JavaScript permissions? Actually, I get the same behavior with the Adobe Acrobat plugin selected, so it's not just the viewer.

more options

Let me revise that. In my daily profile which has been migrated from around the days of Firefox 1, I get the Open/Save/Cancel dialog. Even in Firefox's Safe mode.

However, if I launch Firefox in a new profile, drag and drop works just fine. (File>Open also works fine.) There appears to be a setting at work here, but I'm not sure how to track it down.

由 jscher2000 於 修改

more options

When I copy the mimeTypes.rdf from my daily profile to the new, properly working profile, the PDF handling goes haywire and PDFs open as plain text (i.e., gibberish). I'm not ready to perform the opposite experiment, but I think cor-el's suggestion above (https://support.mozilla.org/en-US/que.../961938#answer-445464) is a logical thing to try.

more options

Maybe it helps to restore the plugin.disable_full_page_plugin_for_types pref to the value used when the PDF viewer is enabled.

  • plugin.disable_full_page_plugin_for_types -> application/pdf
more options

@jscher2000 : thanks

As I said plugin.disable_full_page_plugin_for_types was application/pdf but I thought the suggestion was to reset it and I did that and now FF is not in the "open with" lists in pdfs. Anyway it "was" application/pdf and it made no diff. I'd like to have a definite answer to this - probably a bug report as something is at least undocumented here

more options

If plugin.disable_full_page_plugin_for_types includes application/pdf then Firefox won't use a plugin to embed PDF files in browser window (tab).
Firefox uses this to make it possible to use the built-in PDF Viewer instead.
So if this MIME type isn't included then "Portable Document Format (Preview in Firefox)" isn't possible and only an external viewer can be used or you can save the file.
To be able to use the built-in PDF Viewer you need to add application/pdf to the value of the plugin.disable_full_page_plugin_for_types pref.


more options

@corel : have deleted this preference - FF still uses the internal viewer - please try to reproduce @jscher2000 results - there is a bug someplace here - apparently the profile may carry a setting which prevents opening pdfs in browser - while a new profile works fine

more options

i would accept as an answer a bug report at bugzilla

more options

In my default profile, renaming mimeTypes.rdf to mimeTypes.old and having Firefox regenerate a default file solves the issue. When I compare the files, there are many, many differences. In addition to "application/pdf" type there is the "application/x-pdf" type, and PDF appears as a possible file extension under everything from plain text files to unknown binary files. I don't think there is a simple way to do an elimination test to figure out what is causing Firefox to display the Open/Save/Cancel dialog. I removed the x-pdf stuff and that didn't work. So I removed every strange reference to PDF and then drag-and-drop worked. Not sure how to describe this bug.


Removed the PDF or X-PDF line from these XML elements:

 <RDF:Seq RDF:about="urn:mimetypes:root">
...
   <RDF:li RDF:resource="urn:mimetype:application/x-pdf"/>
...
 </RDF:Seq>
 
 <RDF:Description RDF:about="urn:mimetype:application/x-octet-stream"
                  NC:description="Adobe Acrobat 7.0 Document"
                  NC:value="application/x-octet-stream"
                  NC:editable="true">
   <NC:fileExtensions>pdf</NC:fileExtensions>
   <NC:fileExtensions>htm</NC:fileExtensions>
   <NC:handlerProp RDF:resource="urn:mimetype:handler:application/x-octet-stream"/>
 </RDF:Description>
 <RDF:Description RDF:about="urn:mimetype:application/unknow"
                  NC:description="Adobe Acrobat 7.0 Document"
                  NC:value="application/unknow"
                  NC:editable="true">
   <NC:fileExtensions>pdf</NC:fileExtensions>
   <NC:fileExtensions>htm</NC:fileExtensions>
   <NC:handlerProp RDF:resource="urn:mimetype:handler:application/unknow"/>
 </RDF:Description>
 <RDF:Description RDF:about="urn:mimetype:text/html"
                  NC:description="Adobe Acrobat 7.0 Document"
                  NC:value="text/html"
                  NC:editable="true">
   <NC:fileExtensions>pdf</NC:fileExtensions>
   <NC:fileExtensions>htm</NC:fileExtensions>
   <NC:handlerProp RDF:resource="urn:mimetype:handler:text/html"/>
 </RDF:Description>
 <RDF:Description RDF:about="urn:mimetype:application/"
                  NC:value="application/"
                  NC:editable="true"
                  NC:description="Adobe Acrobat 7.0 Document">
   <NC:fileExtensions>pdf</NC:fileExtensions>
   <NC:fileExtensions>htm</NC:fileExtensions>
   <NC:handlerProp RDF:resource="urn:mimetype:handler:application/"/>
 </RDF:Description>

Removed these elements completely:

 <RDF:Description RDF:about="urn:mimetype:application/x-pdf"
                  NC:fileExtensions="pdf"
                  NC:description="Adobe Acrobat 7.0 Document"
                  NC:value="application/x-pdf"
                  NC:editable="true">
   <NC:handlerProp RDF:resource="urn:mimetype:handler:application/x-pdf"/>
 </RDF:Description>
 <RDF:Description RDF:about="urn:mimetype:handler:application/x-pdf"
                  NC:alwaysAsk="true"
                  NC:saveToDisk="true"
                  NC:useSystemDefault="false">
   <NC:possibleApplication RDF:resource="urn:handler:local:C:\Program Files (x86)\Mozilla Firefox"/>
   <NC:possibleApplication RDF:resource="urn:handler:local:C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe"/>
   <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:application/x-pdf"/>
 </RDF:Description>
 <RDF:Description RDF:about="urn:mimetype:externalApplication:application/x-pdf"
                  NC:prettyName="AcroRd32.exe"
                  NC:path="C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe" />
 <RDF:Description RDF:about="urn:mimetype:binary/octet-stream"
                  NC:fileExtensions="pdf"
                  NC:description="Adobe Acrobat 7.0 Document"
                  NC:value="binary/octet-stream"
                  NC:editable="true">
   <NC:handlerProp RDF:resource="urn:mimetype:handler:binary/octet-stream"/>
 </RDF:Description>
 <RDF:Description RDF:about="urn:mimetype:application/download"
                  NC:fileExtensions="pdf"
                  NC:description="Adobe Acrobat 7.0 Document"
                  NC:value="application/download"
                  NC:editable="true">
   <NC:handlerProp RDF:resource="urn:mimetype:handler:application/download"/>
 </RDF:Description>
more options

Well thanks :) I am a bit reluctant to delete/rename the file as it may affect other things - I will verify ASAP. Please post your findings at bugzilla - this is clearly not intended behavior - and post back here (you could name the bug like Firefox does not offer the option to preview offline pdf in older profiles and drop them a link to this question). Will be accepting your answer as soon I check it on my home machine - but again thanks indeed for your time and effort :)

由 Mr_and_Mrs_D 於 修改

more options

You can file the bug if you like. I need to move on to other issues.

  1. 1
  2. 2