-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not loading md files in firefox on OSX #6
Comments
No, indeed it doesn't, but it should if you set up a mime type for it. See Issue #2 for the solution on Linux (Ubuntu). You'll have to do something similar on OSX; the same solution might even work. Please post here and let us know either way. |
Hi @dmarteau, Keep in mind that the addon does not control FF; FF has control of the addon. So it's not valid to expect the addon to bypass the default file handler. Rather, we need to make the FF file handler hand the file over to the addon. That is not happening now, so the addon never sees it. That is a FF issue. Can you please try the configuration steps mentioned previously for Linux to see if they work on OSX? |
#2 is not working on OSX (there is no update-mime-database command) Also modifying the mimeTypes.rdf is useless since it is regenerated when firefox start. |
According to https://support.mozilla.org/en-US/kb/applications-panel-set-how-firefox-handles-files it should be possible for an extension to register file types handlers. I know that the link is outdated but I would be very surprised if that the api has changed so much that it not possible to register content handlers anymore. |
@dmarteau The page you linked says nothing about extensions registering file type handlers. It is about how you, the user, can tell the browser how to handle various file types. |
Up to know If have found no solutions to make that extension work in OSX since I have found no way to tell Firefox to handle specific kind of files - all solutions that seems to apply to linux does not work. |
As it seems and after some discussions with extension developper, there is no API that expose something like the nsIHandlerService in webextension: your hack for determining the kind of file loaded implies that the file has already been loaded. Actually Firefox mime type handler depends on some system spécifications: this will definitely prevent all extensions using the same hack has to work on some platforms. It seems that there the only solution is to open an issue on https://developer.mozilla.org/fr/docs/Mozilla/Bugzilla and ask for exposing a mime type handler API. |
I created the bug : https://bugzilla.mozilla.org/show_bug.cgi?id=1417022 |
you should have a look at https://addons.mozilla.org/en-US/firefox/addon/open-in-browser/. It seems that this extension inspect the request before FF decides what to do with the file: by changing the mime-type/content-disposition in the header it changes the behavior of FF. |
I will check it out. Thanks! |
They use the webrequest.onHeadersReceived, with "blocking" and "responseHeaders" to modify headers. This allows to add Content-Disposition: inline and maybe change mime types if necessary. This is also where we could strip Content Security Policy headers if we wanted to. However after some testing the |
It seems that some supports for content handlers has been impelemented: https://bugzilla.mozilla.org/show_bug.cgi?id=1356397 |
It rather seems it is not implemented but tracking moved to bug 1457500. |
yes, you are right. But things seems to go it the good direction. |
@dmarteau, have you tried Simeon Velichkov's Markdown Viewer? https://addons.mozilla.org/en-US/firefox/addon/markdown-viewer-chrome/?src=search I believe he's using an approach like you describe. (His extension is much more complete in support of various stylings and features.) However, I also find it extremely quirky. One minute my .md is styled, then when I refresh, it's a blank page and is forever after blank. So I'm afraid to go that route with this viewer. |
I’ve just added another workaround to the README, which should work on macOS as well as on Linux. It’s the one I am using myself now, on FF 78. It uses a It works in 3 simples steps:
|
For others looking into this, after following a chain of duplicate bugs, the correct FF bug is here: https://bugzilla.mozilla.org/show_bug.cgi?id=1457500 |
I tried this in MacOS Catalina with Firefox 92.0 and it does not work. I will note that the |
Too bad − thanks for the feedback @chadj2. It works on Linux but I’m not sure what the right way would be on macOS then, and I don’t have access to a machine on which to test it. |
Fixed in v2 (#99) by opening |
When trying to open a local .md file, FF ask what to do with the file. The extension does not bypass
default file handler.
Firefox 55.0.3
System: OSX (El capitan)
The text was updated successfully, but these errors were encountered: