How to View SharePoint Documents on the Browser

Let us consider any Microsoft document. Office Web Apps (OWA) will help us in viewing the documents on the browser online. 

Note:

For o365, OWA will be configured by default. For on premise, we have to set up a OWA server separately, and configure our server to integrate with OWA server.

For o365, You can find the OOB option to view document online when you right click on the documents. Find the below screen.

 
So lets see how to construct the URL. 
  1. Assuming file is placed under Documents folder.
  2. Copy the document link and paste it on the browser URL area.
  3. Append “?Web=1” at the end of the URL and press enter.
  4. You will see the browser is redirecting to another page called WopiFrame.aspx which shows the document online. "http://siteurl/_layouts/15/WopiFrame.aspx?sourcedoc=<GUID>&file=<filename.extension>&action=default"
  5. You can also see the following parameters appended to the URL.
  6. Sourcedoc – contains the reference to the file path or document GUID.
  7. File – file name with extension.
  8. Action – This paremeter tells us the view mode. It can be any of the following. Default – Opens the document in readable mode and can be edited by clicking on edit document option (OR) Edit – Opens the document in edit mode.

 The approach is same for all SharePoint platforms.

Please find the below screenshot which shows the document online.