Tag: mime

  • Firefox not opening mailto links in Flatpak Thunderbird

    Using Fedora Kinoite Thunderbird comes in a Flatpak. This caused me issues with mailto links in Firefox not opening Thunderbird’s new email window.

    Usually just setting Thunderbird as the default email client inside Thunderbird’s settings or KDE’s default applications would have worked. Even selecting Thunderbird inside the Firefox file handler applications settings would have done the job. However mailto links did nothing but open up the application selector in Firefox which did not work.

    The first two places were already set correctly (in Thunderbird and KDE) so not much more to do there. As I cannot directly select Thunderbird’s binary since it is a Flatpak, I tried to get Firefox to open the Flatpak binary instead and somehow customise the command being run.

    There was just no way to customise the command through its interface, unless I fiddled with handlers.json directly in my Firefox profile directory. I tried a few combinations and no dice. I was also still reluctant to believe that all other users would go through this mess just to get mailto links working which is such a basic feature.

    The most annoying part was that XDG actually returned Thunderbird as the default handler for mailto links:

    $ xdg-mime query default x-scheme-handler/mailto
    org.mozilla.Thunderbird.desktop

    But checking my ~/.config/mimeapps.list file revealed that there was no mailto handler defined. Adding the corresponding entries finally fixed the issue:

    [Added Associations]
    x-scheme-handler/mailto=org.mozilla.Thunderbird.desktop;

    [Default Applications]
    x-scheme-handler/mailto=org.mozilla.Thunderbird.desktop;

    Glad that I got it working but still not satisfied that this was really the way to go, so I decided to start from scratch.

    I went back to KDE’s System Settings>Apps & Windows>Default Applications>Email client. Despite having Thunderbird already selected I went and selected Other… instead. Here I could select Thunderbird again but interestingly there were more options:

    You will notice in my screen-shot the check-box stating “Remember application association for all files of type “x-scheme-handler/mailto“. This check-box once checked actually updates the same ~/.config/mimeapps.list file with the previous entries I mentioned earlier.

    So apparently this is an option which is not enabled by default when just selecting Thunderbird in the default applications list. Why not having mailto links working by default in KDE is a conundrum.

    I am sure there are edge cases not wanting mailto links to open the default email client, but I would assume the vast majority of users expect this behaviour of the default email client. What is the point otherwise of selecting a default application?

  • Google Analytics XHTML compliance

    I had to add the Google Analytics code snippet to this site and had some issues with it validating as XHTML 1.1 and MIME type application/xhtml+xml which were solved at the end.

    The snippet is divided into two pieces of <script> tags and the first part is simply a feature to avoid getting warning messages from your browser if your page was server over SSL (https://). If your site serves pages in both HTTP and HTTPS then you can achieve the same through e.g. a server side scripting language such as PHP.

    The snippet needs to be changed to the following on HTTP pages:

    <script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>

    and of course on HTTPS pages use this piece:

    <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></script>

    Now the second part of the code needs to be put between CDATA tags to properly isolate it. The code will now look like this except you need to introduce your own Google Analytics ID:

    <script type="text/javascript">
    //<![CDATA[
    var pageTracker = _gat._getTracker("UA-1234567-8");
    pageTracker._initData();
    pageTracker._trackPageview();
    //]]>
    </script>

    Now you can safely run the W3 Validator without any errors caused by Google Analytics.