0

I have an application that pulls data from the SharePoint API and displays it on a web page. When the user clicks on the thumbnail, it opens a new page with the document in a WOPIFrame so they can preview it. The action is set to interactivepreview so they can't modify the file. However, if they click the link in the bottom right of the document "Open in New Window" it will open the document in a new window with the action=preview so they can edit it. I want to either prevent the user from opening in a new window, or if they do click this action, open in a new window in interactivepreview mode so they can't edit it. How can I either hide this functionality or modify it so it never opens the document as action=preview?

thanks.

0

To hide the functionality, put your cursor over the element in question on the webpage and right click, inspect element. Look to see if there is an id or class associated with the div or span that contains the words "Open in New Window". Then add or insert some css to set that id or class to display: none !important;

<style> .classname { display: none !important; } </style>

or

<style> #idname { display: none !important; } </style>

You might need to play with a few different classes/ids before you narrow down to the exact one you wish to hide, but this would prevent the user from being able to interact with it.

Make sure that you are not killing other stuff if it is a class.

  • This is in an IFrame, so the content is being served from SharePoint via a WOPI interface, so I don't have control of what is returned from SharePoint to override this with CSS I believe. – john Sep 20 '18 at 21:00
  • Hmm... makes it more difficult. However, you might be able to run a javascript to push the css to hide the element. More info about javascripts and iframes link – Chris Fells Sep 21 '18 at 13:36
0

After looking around it appears that there is no direct way to disable this feature. It is all dependent on the permissions of the user. Any other solution (pushing CSS to an IFrame) is a hack and not a solution. SharePoint controls the permissions and will act accordingly for the user/credentials that were used to open the document.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.