Posts

Showing posts from June, 2016

Redirect user when document closes in office web apps

Issue: We have a links to presentations on the page and when user clicks on the link the presentation is opening in Office Web Apps perfectly. But the issue is when user closes the document by clicking "X" icon on the top right, the user is being redirected to document library, whereas user wants to redirect to the page where he/she starts that is to the page where presentation links exist. We cannot even send current page URL with source parameter like other list forms because the Web app viewer uses the URL available in WOPI Session Context cookie and if there is no cookie/URL exist then it will redirect to document library view by default. Solution: So before launching document in Web app viewer we have to update the cookie. window.document.cookie = "WOPISessionContext=<Page URL>;path=/"; You can use the following script for this. <script type="text/javascript"> function openUrl() { window.document.cookie="WOPISessionCont...