"Hey I have a link to a Word document in a SharePoint document library and I have this link on a page to it that I want to open directly in the browser [Word Online]."
"Sure no problem, just append ?web=1 to the link"
"Wow, cool! Can you do the same for opening directly in Word?"
Just linking to the document would offer it as download
I considered a complex hyperlink with an onclick handler that would then open it in Word etcetera etcetera, very convoluted and a thing from the past really.
Then I found out about the Office URI Schemes:
- ms-word:ofe|u| https://mysharepoint/mylibrary/mydocument.docx
ofv = open for view, ofe = open for edit
You can read up on them here: https://docs.microsoft.com/en-us/office/client-developer/office-uri-schemes
Even works in emails if you can construct the hyperlink href yourself. In a simple text mail it will not detect as a hyperlink and just render plain text.
Must admit that was a TIL.