I’d like to create a webextension who open a zim file.
Someone can explain to me how i need to tell to firefox that he can open it and how can i mention that is my extension who must do it.
My actual solution (dirty) :
a python script who
1.decode zim file and extract all files in a temp directory.
2. launch firefox with the index.html
Assuming your file is not too big (i mean not over a few MBs), you can easily read a local file just using the HTML5 API (not need for a special add-on API here). The only requirement is that the file opening is initiated by the user clicking on an <input type="file"> element. You will find many examples of this method, for instance here).
I redefine my project : I created a web app who add interactive content to pictures or svg : https://mothsart.github.io/labo/frontend/edit_interactive_svg/
In a second time, i contribute to a french and educative linux distribution : Primtux.
Finally, i start to work on a picture book and his editor (just a proof of concept actually) : https://mothsart.github.io/labo/frontend/edit_interactive_svg/picture_book.html
Teachers who use this app, must use this like a native and offline app and share her work with a unique file.
One illustration can bring 1 or several Mo and the picture book have no real limit.
For this 2 reasons, i don’t want to open firstly firefox and using a input file.
I want to propose opening a zim file, with a proper extension (like picture_book.illu).
Wouldn’t it be possible to monitor loaded URLs in tabs and when you see one that ends with .illu, you inject a script that modifies the DOM the way you want ?
interresting, seems good on http protocol (http://…my_file.illu) but not for file protocol (file://…/my_file.illu) :
Firefox open a dialog (what should firefox do with this file?) instead of going on background script.