"An era can be said to end when its basic illusions are exhausted." - Arthur Miller

Thursday, March 08, 2018

Firefox: "Do This Automatically for Files Like This" Is Greyed Out

Recently Firefox changed how the browser works at a fundamental level in what they called Firefox Quantum or Firefox v57 and up. Despite the update one of the long term problems (to me anyway) is the issue of the open dialog box where "Do this automatically for files like this from now on." is greyed out. As a result you do not get to tell Firefox how to handles these file types (or extension and what Mozilla calls a MimeType) from now on so do not have to keep verifying if it should download automatically or open a certain program. There is a technical reason for why its greyed out but it really doesn't matter because its a server side setting that you as the user has no control over and so you can't force that option to not be greyed out. The problem is the powers that be at Mozilla have long decided that the user should not be able to manually add extensions types via the gui interface.

Fortunately there is a fix that I found by combined multiple poor answers from various forums. Why people skip all the steps when explaining how to fix something always confuses me since they are trying to be helpful but provide answers that assumes their audience mostly knows the answer and just needs a nudge in a particular direction. In the pre-quantum days, the fix involved editing the mimeTypes.rdf file. Now it involves editing a different file called handlers.json. Now these instructions are going to assume you know the basics of your computer as some parts will change based on which version of Windows you have. If not sure how to do something like open Windows Explorer or Run, google it for your operating system.

To start, see how things are setup currently so you can tell if your changes worked.

- Go to the Hamburger Icon (three dashes stacked in a column) > then click Options.

- In the Options tab that opens, go to the search box and type "Applications" as see in screenshot (alternatively click "General" then scroll down to "Application" section).

- Take a mental snapshot or a literal one so can tell if your changes are working.

Add file extensions to this list:

- Via Windows Explorer or Run, go to: %AppData%\Mozilla\Firefox\Profiles > then double-click your Firefox profile folder (usually only one there or one with most recent change date).

- Scroll past the folders to the individual files and look for: handlers.json > copy this file and save it on your desktop. This is just a back-up in case have to reset your changes.

- Now in the Profiles folder right-click over handlers.json > click Edit

- A text file will open that looks something like this assuming Word Wrap is checked:
{"defaultHandlersVersion":{"en-US":4},"mimeTypes":{},"schemes":{"ircs":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"mailto":{"action":4,"handlers":[null,{"name":"Yahoo! Mail","uriTemplate":"https://compose.mail.yahoo.com/?To=%s"},{"name":"Gmail","uriTemplate":"https://mail.google.com/mail/?extsrc=mailto&url=%s"}]},"irc":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"webcal":{"action":4,"ask":true,"handlers":[null,{"name":"30 Boxes","uriTemplate":"https://30boxes.com/external/widget?refer=ff&url=%s"}]}}}

- For each file type you want to add to the list, the goal is to insert this text in the correct location based on file format where FileType=""> is what you want to add:
,"application/FileType":{"action":0,"extensions":["FileType"]}

- Create your own list like example below keeping the beginning , and the ending }
Examples:
,"application/mp3":{"action":0,"extensions":["mp3"]}
,"application/rar":{"action":0,"extensions":["rar"]}
,"application/zip":{"action":0,"extensions":["zip"]}

- Combine that list, without spaces anywhere
Example:
,"application/mp3":{"action":0,"extensions":["mp3"]},"application/rar":{"action":0,"extensions":["rar"]},"application/zip":{"action":0,"extensions":["zip"]}

- Now delete the very first comma only
Example:
"application/mp3":{"action":0,"extensions":["mp3"]},"application/rar":{"action":0,"extensions":["rar"]},"application/zip":{"action":0,"extensions":["zip"]}

- Copy and paste your combined code

- Go back to the open handlers.json file. Look for this section of code at the very beginning:
{"defaultHandlersVersion":{"en-US":4},"mimeTypes":{}

- See those two brackets after "mimeTypes"? That is where you will paste your code.
Example:
{"defaultHandlersVersion":{"en-US":4},"mimeTypes":{"application/mp3":{"action":0,"extensions":["mp3"]},"application/rar":{"action":0,"extensions":["rar"]},"application/zip":{"action":0,"extensions":["zip"]}},"schemes":{"ircs":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"mailto":{"action":4,"handlers":[null,{"name":"Yahoo! Mail","uriTemplate":"https://compose.mail.yahoo.com/?To=%s"},{"name":"Gmail","uriTemplate":"https://mail.google.com/mail/?extsrc=mailto&url=%s"}]},"irc":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"webcal":{"action":4,"ask":true,"handlers":[null,{"name":"30 Boxes","uriTemplate":"https://30boxes.com/external/widget?refer=ff&url=%s"}]}}}

- Save the text file (not "Save As", just "Save")

- Close Firefox.

- Re-open Firefox.

- Go to the Hamburger Icon > Options > type "Applications" in search box > see if your items are in the list (see screenshot)

- With my config, the default behavior is "Save File" but click the drop down for each and make changes as you see fit.

If you wish to add more formats later, go to the code and look for },"schemes":. You will make the changes right before the }.
For example, lets add an mkv file type. So from above the code is this: ,"application/mkv":{"action":0,"extensions":["mkv"]}

- To add:
Example:
{"defaultHandlersVersion":{"en-US":4},"mimeTypes":{"application/mp3":{"action":0,"extensions":["mp3"]},"application/rar":{"action":0,"extensions":["rar"]},"application/zip":{"action":0,"extensions":["zip"]}},"schemes":{"ircs":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"mailto":{"action":4,"handlers":[null,{"name":"Yahoo! Mail","uriTemplate":"https://compose.mail.yahoo.com/?To=%s"},{"name":"Gmail","uriTemplate":"https://mail.google.com/mail/?extsrc=mailto&url=%s"}]},"irc":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"webcal":{"action":4,"ask":true,"handlers":[null,{"name":"30 Boxes","uriTemplate":"https://30boxes.com/external/widget?refer=ff&url=%s"}]}}}

- Now becomes
Example:
{"defaultHandlersVersion":{"en-US":4},"mimeTypes":{"application/mp3":{"action":0,"extensions":["mp3"]},"application/rar":{"action":0,"extensions":["rar"]},"application/zip":{"action":0,"extensions":["zip"]},"application/mkv":{"action":0,"extensions":["mkv"]}},"schemes":{"ircs":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"mailto":{"action":4,"handlers":[null,{"name":"Yahoo! Mail","uriTemplate":"https://compose.mail.yahoo.com/?To=%s"},{"name":"Gmail","uriTemplate":"https://mail.google.com/mail/?extsrc=mailto&url=%s"}]},"irc":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"webcal":{"action":4,"ask":true,"handlers":[null,{"name":"30 Boxes","uriTemplate":"https://30boxes.com/external/widget?refer=ff&url=%s"}]}}}

- Remember to close and re-open Firefox to apply the change.

If you mess up, don't forget you have the original file on your desktop. Just copy it and paste it back to the profiles folder, confirming you want to replace the previous file. Just like that you reset your changes. Alternatively you can close Firefox, delete handlers.json, and when you open Firefox again it will recreate the file as when program was first installed.



No comments:

Post a Comment