SharePoint Online - Make Office File to Open in Desktop Application by default Instead of Online

In a SharePoint documents library, documents will be opened in client application by default, if the “Open Documents in Client Applications by Default site” site collection feature is activated.

However, if you use document URL as a link in another place, clicking the link will not open document in desktop application. It will open the document in online app.

Solution for that is, add respective Office URI Scheme to the beginning of the document URL. For a Excel document, link should be like: ms-excel:ofe|u|………
List of URL scheme names available for Microsoft Office applications are:
  • ms-word:
  • ms-powerpoint:
  • ms-excel:
  • ms-visio:
  • ms-access:
  • ms-project:
  • ms-publisher:
  • ms-spd:
  • ms-infopath:

Sample jQuery code to open an Excel document in desktop application on a button click is:
$("#btnOpenExcelFile" ).click (function() { "ms-excel:ofe|u|");