In SharePoint Online, when you open a document directly from a document library, it will open it in the browser using the corresponding online application. However, if you open it via a direct link, whether that is a page, e-mail, or a custom link, it will download to your local machine. What can you do to get the desired behavior, and open in the corresponding online application if possible?

Thankfully, this is an easy fix.

Simply append ?Web=1 to the end of your URL.

So if your original link looks like this:

You need to change it to look like this:

This will solve the issue, and will open the link in the correct application if possible.