0

We are attempting to display a document library view in an iFrame on a page withing Dynamics CRM and then open the documents from that list within the iFrame as well. The issue we are having is that Office documents (Word, Excel, etc.) work fine and open up in the iFrame just as we expect. However; PDF's that are stored in the Library throw the error that for security reasons they cannot be opened in a frame, iFrame etc. I suspect that this is due to the PDF web viewer, in use, adding the x-frame header element that tells the browser that this is not allowed.

I have found JavaScript that can be run on the page that plows through all hrefs and altering them so that they open in a new window. I'm not 100% sure that this will work given that the links that SharePoint builds are quite complex and don't appear to use the default functionality that a typical element uses to open the hyperlink. The other issue with this approach is where to put the JavaScript. The page that displays the document library uses an Out-of-the-box web part to do so. Will simply adding the JavaScript to a Content Editor web part in the same page get to the links that SharePoint creates for the documents? Will it cause problems with those links given their complexity?

Is there a better way to force the PDF web viewer to allow being opened in an iFrame or at least a more configuration driven way to get the documents to open in a new window?

This is a SharePoint Online environment that we don't control so any solutions that require server access are a non starter.

1

There are OOTB limitations on opening certain file types in the browser, and PDF is one of them. If you have a library and enable the default to open in browser, and PDFs in that library open in Acrobat instead of the browser, this is likely your problem. There are some solutions here, and discussion regarding the issue here.

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.