Opening webdav ms-word:ofe|u| protocol links with LibreOffice

Solution 1:

It is possible to achieve similar behaviour in Linux as well by registering the ms-word protocol handler. However, there are some limitations, but for the basic usage, it will work.

First, a new protocol has to be registered and an application that will open it. The application .desktop files will handle the new protocol, and they are located in /usr/share/applications. LibreOffice uses the libreoffice-writer.desktop file, so you may copy this file to libreoffice-writer-msword.desktop. A copy is needed because the libre office does not understand ms-word:ofe|u| part, so it is required to strip it from the command line. In the new .desktop file, put the following in the Exec line:

Exec=bash -c 'echo "%U" | cut -d "|" -f 3 | xargs /usr/bin/libreoffice --writer'

Next, a new protocol handler should be registered with this command:

xdg-mime default libreoffice-writer-msword.desktop  x-scheme-handler/ms-word

This will register our desktop file with ms-word: protocol.

The next step is to test. The best is to try from Firefox, enter this URL in the command line:

ms-word:ofe|u|https://file-examples-com.github.io/uploads/2017/02/file-sample_100kB.doc

Firefox should prompt for opening the LibreOffice, which will open the document from the given location.

However, there are drawbacks:

  • The ofe:u part of the URL is a parameter that can only be interpreted by word. We are striping this part and using default open functionality. Probably this can be replaced by some scripting that would consider LibreOffice parameters.
  • Chrome has some issues with entering custom handlers in the omnibox (the box where you enter URL). It always does google search; it seems this is the default for all Chromium-based browsers (tested on Chrome, Opera and Brave). However, it works from JavaScript - if you enter in the browser console:
    window.location="ms-word:ofe|u|https://file-examples-com.github.io/uploads/2017/02/file-sample_100kB.doc"

Chrome will do the same as Firefox or Vivaldi browsers - it will open the application using xdg-open. It seems that this is the case with any other custom handler like zoommtg: (Zoom video calls); it works with JS, but not from omnibox.