Making a Link to a Document in SharePoint 2013 Open in Browser
In SharePoint Online or 2013 on-premise with Office Web Apps (OWA), when you open a document from the library it resides in, it will open in the browser using OWA.
However, if you open it from a direct link (on a page, from an email, generated by custom code, etc) it will be downloaded and opened in the client, not the browser. This will happen regardless of the default open behaviour for browser enabled documents.
In my case, I have two documents (Word. docx, Text. tct) first one can be opened in OWA, second one cannot. I have created a standard publishing page and added links to both of them.
Clicking on either document will download it.
But what I want is to open it in the browser.
A known workaround is to edit the link and use format like:
<Site URL>/_layouts/15/WopiFrame.aspx?sourcedoc=<Doc URL>&action=default
But, this is time-consuming and error prone, and will work fine for documents that OWA can open, but won’t work for ones that can’t (like.txt)
The solution it to append ?Web=1 at the end of the URL:
This will open them in the browser using OWA, if possible, but otherwise it will download them.
I hope you found this blog helpful, but please let us know if you had any problems.