User Tools

Site Tools


doc:appunti:linux:tux:mimetype

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:tux:mimetype [2020/09/23 21:22] – [Application associated to a MIME Type] niccolodoc:appunti:linux:tux:mimetype [2020/09/23 21:43] (current) – [MIME Type application/x-image-playlist] niccolo
Line 56: Line 56:
  
 <code xml> <code xml>
 +<!-- WARNING! This file is not optimal, see below for the final version. -->
 <?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
 <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
Line 159: Line 160:
 </code> </code>
  
-We check also the behaviour of the Firefox browser, we prepare an HTML file containing this (notice the **anchor** tag uses the **type** attribute to declare the proper MIME type):+We check also the behaviour of the **Firefox** browser, we prepare an HTML file containing this (notice the **anchor** tag uses the **type** attribute to declare the proper MIME type):
  
 <code xml> <code xml>
Line 167: Line 168:
 Once clicked the link, Firefox displays the //Open with...// dialog box suggesting to use **VLC** to open the **MPEG Audio URL**.  If you click over the //Other...// option, Firefox says **No applications found for "M3U Images Playlist" files**. The MIME Type is recognized, but the application to handle it is unknown. Once clicked the link, Firefox displays the //Open with...// dialog box suggesting to use **VLC** to open the **MPEG Audio URL**.  If you click over the //Other...// option, Firefox says **No applications found for "M3U Images Playlist" files**. The MIME Type is recognized, but the application to handle it is unknown.
  
-Prepare a file and save it as **/usr/local/share/applications/photo-reframe.desktop**:+Now we prepare a file and save it as **/usr/local/share/applications/photo-reframe.desktop**:
  
 <file> <file>
Line 190: Line 191:
 </file> </file>
  
-then we run the **update-desktop-database** (which will update the **mimeinfo.cache** file):+then we run the **update-desktop-database** over that directory (it will update the **mimeinfo.cache** file in the same directory):
  
 <code> <code>
Line 196: Line 197:
 </code> </code>
  
-After this step, Firefox suggests to use **Photo-Reframe (default)** to handle the link, you can check the box **Do this automatically for files like this from now on** and the associated application will be launched automatically whenever you will click over a link like this. +Something good has happened; the system knows how to handle that MIME type:
  
 +<code>
 +xdg-mime query default application/x-image-playlist
 +photo-reframe.desktop
 +</code>
 +
 +After this step, Firefox suggests to use **Photo-Reframe (default)** to handle the link, you can check the box **Do this automatically for files like this from now on** and the associated application will be launched automatically whenever you will click over a link like this. Only after this association, you can open the Firefox **Preferences** => **Applications** and browse for the //M3U Images Playlist// and assign the preferred action.
 +
 +**NOTICE**: You may need to use **Shift-Click** to force the reloading of the link, otherwise Firefox may get the object from the cache, where the MIME type is cached too.
 +===== Useless recipes =====
 +
 +There are many recipes to add a new MIME Type and an associated applications, many of them suggest to edit some system files. In our experience it is **absolutely useless to modify** the following files:
 +
 +  * /etc/mailcap
 +  * /etc/mime.types
 +  * $HOME/.mozilla/firefox/<profile>.default/mimeTypes.rdf
 +  * $HOME/.mozilla/firefox/<profile>.default/handlers.json
  
 ===== Opening local files from an HTTP page ===== ===== Opening local files from an HTTP page =====
doc/appunti/linux/tux/mimetype.1600888931.txt.gz · Last modified: 2020/09/23 21:22 by niccolo