Question

I have noticed that: If the Mozilla Firefox user clicks on download link (EX: this), the following "Open with/Save" dialog window will pop up:

Open with/ Save dialog

I have download manager named rd written in Python, So I need to:

  1. Catch the download link from Firefox.

  2. Send it to my download manager.

I want to achieve that by any method of the following:

  • Add checkbox to that dialog enabling the user to use my download manager in this link (as DTA and flashgot add thier checkboxes).
  • Listen for that event ( save dialog pop up),
  • Add my download manager named rd as a default application for any file type other than html but We should give the user the ability to add to/remove from that file types send to my application.
Was it helpful?

Solution

This is handled by Firefox's MIME type handling and can be configured by editing MimeTypes.rdf. I don't think there is a way to handle all but a certain type, rather it seems you have to explicitly enable your app for every MIME type you wish to handle.

Here's an example of setting the handler of .png files to your rd program.

  <RDF:Description RDF:about="urn:mimetype:image/png"
                   NC:fileExtensions="png"
                   NC:description="PNG Image"
                   NC:value="image/png"
                   NC:editable="true">
    <NC:handlerProp RDF:resource="urn:mimetype:handler:image/png"/>
  </RDF:Description>

  <RDF:Description RDF:about="urn:mimetype:handler:image/png"
                   NC:alwaysAsk="false"
                   NC:saveToDisk="false"
                   NC:useSystemDefault="false"
                   NC:handleInternal="false">
    <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:image/png"/>
  </RDF:Description>

  <RDF:Description RDF:about="urn:mimetype:externalApplication:image/png"
                   NC:path="[PATH TO rd]"
                   NC:prettyName="rd" />

As for enabling the user to change the default handler to something else, this is already enabled in Firefox's preferences (Preferences->Applications).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top