​I created a custom display template for rendering information about particular kinds of documents in the site I was building in SharePoint Online. However, users noticed something inconvenient; when users opened the document from Firefox, if they they clicked the Save button, Word, Excel, or PowerPoint tried to save the document to the TEMP directory on their hard drive instead of back to the SharePoint library where the file belonged. It turns out that when you create the anchor tag in the display template, you need to add a piece of javascript to the onclick function of the link, like this:
onclick="return DispEx(this,event,'TRUE','FALSE','FALSE', 'SharePoint.OpenDocuments.3','1', 'SharePoint.OpenDocuments','','','','1','0','0','0x7fffffffffffffff','','')

I was able to figure this out by looking at
this post on Stack Exchange.