Webconverger – Disabling File Save/Download Dialogs

One of the reasons that I enjoy my work customizing Firefox and building add-ons so much is that just about every request I get is a puzzle. They usually start with a question like “Is it possible for Firefox to…” or “Can you make Firefox…” When one of these questions is asked, I start going down the rabbitfox hole and usually end up with some way to do what the client has asked. A lot of the same questions are asked so often that most of the time the answer involves giving them something I’ve already done or piecing together things I’ve already built. Occasionally, though, I get asked to do something that I’ve never done before. And that’s a lot of fun.

Lately I’ve been helping out a project called Webconverger which is an open source web kiosk. There’s also an add-on on AMO. Recently Kai Hendry, the maintainer, asked an interesting question – “Can you prevent Firefox from automatically downloading unknown files from web pages?” To understand why that is an issue, you need to understand what Firefox does when you click on a link to download a file.

When you go to a page that has an EXE or an ISO or something like that and you click the link, a dialog is displayed to ask you what to do with the file, but in the background, Firefox has already begun the download. After you make your selection, Firefox will move the file to the appropriate place. What this means is that even if you cancel the download, the bandwidth is already used. There are some kiosks that are in limited bandwidth situations, so they want to prevent this from happening at all.

As I began to investigate the problem, I looked into common things like nsIContentPolicy to see if I could just stop the files from being downloaded. Unfortunately at that point, we don’t have mime types or anything interesting that will help us determine that it’s not a file we want to download. So I turned my focus to the dialogs themselves. When you download an unknown file you get a dialog that asks you what to do. I could override that dialog and not display it, but that still doesn’t cancel the download. It also doesn’t help in cases where you are presented with a save dialog immediately. As I dug deeper into the problem, I discovered that one interface controlled both of those cases – nsIHelperAppLauncherDialog.

By overriding this interface and cancelling the dialog in both the show and the promptForSave case, I was able to prevent the download of files..

And that solved the puzzle.

If there’s anything I’ve learned as I’ve worked with Firefox over the years, there’s many ways to solve the same problem, so if you have a better way that I could have done this, please let me know.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

34 thoughts on “Webconverger – Disabling File Save/Download Dialogs

  1. Hi!

    I would love to know if it is possible to make firefox fetch its configuration
    data from an LDAP server instead of locally. In scenarios. where you’d
    compare firefox to IE when it comes to central management of a large installbase firefox still lacks behind IE which makes it very much less of an option on corporate desktops.



    • Andreas,

      I don’t know of any products that allow Firefox to read it’s configuration from an LDAP server. Group policy support is something that has been requested for a while.

    • Hi Andreas

      FF won’t (AFAIK) pull from an LDAP server but it will from a web server which is a step in the right direction. Have a look at setting:

      in a local cfg file.



  2. Hello Mike,

    I’m able to use this extension. But the “new window” button in the navigator toolbar is disabled, after I installed this. I have added the button previously by editing the localstore.rdf. Could you please tell me how to enable it again, by keeping the extension?


    • Webconverger is a kiosk extension, so in that scenario you wouldn’t want a new window button. That’s why it is removed.

      • I understand that. But I’m trying for a partially kiosk environment. So in my case it is needed and I have enabled it by setting .


        • So if you’d like that button back, you can edit the webconverger.xul file.

          Remove these two lines:

          <command id=”cmd_newNavigator” disabled=”true”/>
          <key id=”key_newNavigator” disabled=”true”/>

          And you’ll get that back.

          • Yes, I have already turned that “true” to “false” and enabled the new window button. I have replied about it, but for some reason that statement is removed from my reply.

            Thanks for your reply.

            Another problem, I have enabled the Bookmark toolbar and added some bookmark items. But the right-click context menu of the Bookmark Toolbar is also getting enabled. Can I disable the context menu alone and display the Bookmark Toolbar ? I don’t want the user to modify the Bookmark Toolbar, but just use the already available bookmark items.


          • (Replying here since WordPress won’t let me nest)

            To do that, put this in the XUL

            <toolbar id=”PersonalToolbar” context=””>

            That should do it.

            It’s saying “for the toolbar with the id of PersonalToolbar, don’t have a context menu”

            • It doesn’t work. I have added that line for PersonalToolbar in the wc.xul. But the context menu is still coming. Please help.

          • I found a method that works in my testing:

            <toolbar id=”PersonalToolbar” oncontextmenu=”event.preventDefault();”/>

            • Thanks a lot. It works.

              I have set my homepage manually by modifying the browserconfig.properties file in the en-US.jar. Is it possible for me to do this with your extension, so that I don’t want to modify the en-US.jar.

              Please advise.


          • Yes, it’s unfortunate but if you set the homepage via a pref, you have to point it to a properties file because it is a complex pref. There’s really no easy way around that. I think I’ll open a bug against Mozilla for that.

            Maybe webconverger can be modified to do that better as well.

            • Mike,

              So there is no way to move the changes made in the en-US.jar to the webconverger extension, right? (for setting the homepage)

              I did the following in the .properties file inside en-US.jar

              Please help,

          • I just remembered there is a hack to getting this to work.



          • Webconverger doesn’t currently user properties files at all.

            But you could certainly add one for this specific purpose.

            Then you could point the homepage preference to that properties file to get the homepage URL.

    • Mike,

      Thanks for the reply.

      I’m using iceweasel and that’s the reason I had to modify the en-US.jar. I have also made the following change to firefox.js file.

      pref(“browser.startup.homepage”, “chrome://branding/locale/browserconfig.properties”);
      pref(“browser.startup.page”, 1);

      I believe that the methods you suggest (distribution.ini and config file) are supposed to be done outside the KIOSK plugin. Am I correct? But I thought of making it as part of the KIOSK plugin.

      Please reply.

      • Just curious, did you try:

        pref(“browser.startup.homepage”, “http://mike.kaply.com”);

        in the firefox.js?

        I just tested and it is working for me. I have no idea when it started working (it didn’t used to).

        • Yes, I tried that. As I’m using iceweasel branding, the following displayed a blank page in the iceweasel.

          pref(“browser.startup.homepage”, “http://mike.kaply.com”);

          So I found that firefox.js should be as below.
          pref(“browser.startup.homepage”, “chrome://branding/locale/browserconfig.properties”);

          And I modified en-US.jar, which has a browser.startup.homepage. I set this to “http://www.yahoo.com”.

  3. Hello Mike,

    Is it possible to disable the tab window feature in firefox using your extension? Just displaying one window, without the tab feature.


  4. Hello Mike,

    I want to disable the File Upload dialogs that are initiated from the webpages (Browse button). So I did the following code in userContent.css. It works fine ( There is a small problem. It hides the Browse buttons in the webpages. But that is ok).

    The main issue is that in gmail -> Compose Mail, there is an “Attach a File” option. The following code is not disabling it. Can you suggest your opinion , how to make this working in gmail? Thanks.


    display: none !important;

  5. Hi,

    I’ve just found your solution and I’d like to use it in my project, what the license of your code ? (public domain, BSD…)


  6. is it possible that if i open a .xpi in chrome and firefox is not yet installed.then firs it install the browser and then installs the xpi without any confirmation with default settings.

    Sahil kakkat

  7. firefox has disabled my robo form lite how can i recover it, i have try ed
    about:config – xpi – xpinstall.signatures.required it didn’t work